FIMS  v0.8.0
Loading...
Searching...
No Matches
fims::FIMSLog Class Reference

#include <def.hpp>

Public Member Functions

 FIMSLog ()
 
 ~FIMSLog ()
 
std::filesystem::path getAbsolutePathWithoutDotDot (const std::filesystem::path &relativePath)
 Get the Absolute Path Without Dot Dot object.
 
void set_path (std::string path)
 
std::string get_path ()
 
void info_message (std::string str, int line, const char *file, const char *func)
 
void debug_message (std::string str, int line, const char *file, const char *func)
 
void error_message (std::string str, int line, const char *file, const char *func)
 
void warning_message (std::string str, int line, const char *file, const char *func)
 
std::string get_log ()
 
std::string get_errors ()
 
std::string get_warnings ()
 
std::string get_info ()
 
std::string get_module (const std::string &module)
 
size_t get_error_count () const
 Get the counts of the number of errors.
 
size_t get_warning_count () const
 Get the counts of the number of warnings.
 
void clear ()
 Clears all pointers/references of a FIMS model.
 

Public Attributes

bool write_on_exit = true
 A boolean specifying if the log file is written when the session is terminated. The default is TRUE.
 
bool throw_on_error = false
 A boolean specifying if the program is stopped upon the first error, where the default is FALSE. This allows you go through an entire program to collect all error messages.
 

Static Public Attributes

static std::shared_ptr< FIMSLogfims_log = std::make_shared<FIMSLog>()
 A singleton instance of the log, i.e., where there is only one log. The object is created when the .dll is loaded and it will never be recreated while the .dll is loaded.
 

Detailed Description

FIMS logging class.

Constructor & Destructor Documentation

◆ FIMSLog()

fims::FIMSLog::FIMSLog ( )
inline

Default constructor for FIMSLog.

◆ ~FIMSLog()

fims::FIMSLog::~FIMSLog ( )
inline

Destructor. If write_on_exit is set to true, the log will be written to the disk in JSON format.

Member Function Documentation

◆ debug_message()

void fims::FIMSLog::debug_message ( std::string  str,
int  line,
const char file,
const char func 
)
inline

Add a "debug" level message to the log.

Parameters
str
line
file
func

◆ error_message()

void fims::FIMSLog::error_message ( std::string  str,
int  line,
const char file,
const char func 
)
inline

Add a "error" level message to the log.

Parameters
str
line
file
func

◆ get_errors()

std::string fims::FIMSLog::get_errors ( )
inline

Return only error entries from the log.

Returns

◆ get_info()

std::string fims::FIMSLog::get_info ( )
inline

Return only info entries from the log.

Returns

◆ get_log()

std::string fims::FIMSLog::get_log ( )
inline

Get the log as a string object.

Returns

◆ get_module()

std::string fims::FIMSLog::get_module ( const std::string &  module)
inline

Query the log by module.

Parameters
module
Returns

◆ get_path()

std::string fims::FIMSLog::get_path ( )
inline

Get the path for the log file.

Returns

◆ get_warnings()

std::string fims::FIMSLog::get_warnings ( )
inline

Return only warning entries from the log.

Returns

◆ getAbsolutePathWithoutDotDot()

std::filesystem::path fims::FIMSLog::getAbsolutePathWithoutDotDot ( const std::filesystem::path &  relativePath)
inline

Get the Absolute Path Without Dot Dot object.

Dot dot notation is for relative paths, where this function replaces all dot dots with the actual full path.

Parameters
relativePathA path in your file system.
Returns
std::filesystem::path

◆ info_message()

void fims::FIMSLog::info_message ( std::string  str,
int  line,
const char file,
const char func 
)
inline

Add a "info" level message to the log.

Parameters
str
line
file
func

◆ set_path()

void fims::FIMSLog::set_path ( std::string  path)
inline

Set a path for the log file.

Parameters
path

◆ warning_message()

void fims::FIMSLog::warning_message ( std::string  str,
int  line,
const char file,
const char func 
)
inline

Add a "warning" level message to the log.

Parameters
str
line
file
func

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