FIMS  v0.9.2
Loading...
Searching...
No Matches
fims::LogEntry Struct Reference

A data structure with defined fields for a single log record. More...

#include <def.hpp>

Public Member Functions

std::string to_string ()
 Serialize this entry to a JSON object string.
 

Public Attributes

std::string timestamp
 The date and time that the log entry was created.
 
std::string message
 The description of the log entry.
 
std::string level
 The logging level associated with the entry.
 
size_t rank
 The message identifier corresponding to creation order.
 
std::string user
 The user name registered on the machine where the log was created.
 
std::string wd
 The working directory for the environment that created the log.
 
std::string file
 The full file path of the file that triggered the log entry.
 
std::string routine
 The function or method that initiated the log entry.
 
int line
 The line in file where the log entry was initiated.
 

Detailed Description

A data structure with defined fields for a single log record.

At run time, each log entry is stored in this structure with information on timestamp, severity level, message text, sequence id, username, working directory, source file, routine, and source line.

Member Function Documentation

◆ to_string()

std::string fims::LogEntry::to_string ( )
inline

Serialize this entry to a JSON object string.

Returns
A JSON object represented as a string (without trailing comma).

Member Data Documentation

◆ file

std::string fims::LogEntry::file

The full file path of the file that triggered the log entry.

Example: "C:/github/NOAA-FIMS/FIMS/inst/include/interface/rcpp/rcpp_objects/rcpp_selectivity.hpp".

◆ level

std::string fims::LogEntry::level

The logging level associated with the entry.

The level is determined by the macro used to generate the message, for example FIMS_INFO_LOG(), FIMS_WARNING_LOG(), or FIMS_ERROR_LOG(), which map to "info", "warning", and "error", respectively.

◆ line

int fims::LogEntry::line

The line in file where the log entry was initiated.

Example: "219", which is a line inside the routine listed above.

◆ message

std::string fims::LogEntry::message

The description of the log entry.

Example messages include "Adding Selectivity object to TMB" or "Mismatch dimension error", where descriptions are predefined in the C++ code.

◆ rank

size_t fims::LogEntry::rank

The message identifier corresponding to creation order.

Example: "1". This helps track operation ordering across model runs.

◆ routine

std::string fims::LogEntry::routine

The function or method that initiated the log entry.

Example: "virtual bool LogisticSelectivityInterface::add_to_fims_tmb()". For templated functions, type information is reported in square brackets, for example: "bool fims_info::Information<Type>::CreateModel() [with Type = double]".

◆ timestamp

std::string fims::LogEntry::timestamp

The date and time that the log entry was created.

Example: "Oct 28 09:18:51 2024". You can track how long it took to work through each portion of the model by analyzing the progression of the timestamp through the log file.

◆ user

std::string fims::LogEntry::user

The user name registered on the machine where the log was created.

Example: "John.Doe".

◆ wd

std::string fims::LogEntry::wd

The working directory for the environment that created the log.

Example on Windows: "C:/github/NOAA-FIMS/FIMS/vignettes". Example on Linux: "/home/oppy/FIMS-Testing/dev/dev_logging/FIMS/vignettes".


The documentation for this struct was generated from the following file: