INFM HIL Interface
Interface between Artery simulation and DuTs
Static Public Member Functions | List of all members
sim_interface::InterfaceLogger Class Reference

Logger to log to file, console and as structured data csv More...

#include <InterfaceLogger.h>

Static Public Member Functions

static void initializeLogger (const LoggerConfig &con)
 
static void logMessage (const std::string &msg, LOG_LEVEL level)
 
static void logMessage (const std::string &msg, LOG_LEVEL level, bool writeToFile)
 
static void changeLogLevel (LOG_TYPE typ, LOG_LEVEL level)
 
static void logEvent (sim_interface::SimEvent event)
 

Detailed Description

Logger to log to file, console and as structured data csv

This logger is a tool with specialized functions to log and store messages for all elements of the Sim_To_DuT_Interface. The logger and all of it's functions are static so it's not necessary to create instances of the logger to write a message. Please notice that the logger has to be initialised in a first call by a valid configuration before using it.

With logger's functionality it's possible to log messages and events during the execution.

The logger will create files if necessary in which the messages will be stored. The message provider can choose if the message should be logged in the file or not. The logger notices old logfiles and will remove them if the real number of logfiles is higher than the configured backup count.

Author
Marco Keul
Version
1.0

Member Function Documentation

◆ changeLogLevel()

void sim_interface::InterfaceLogger::changeLogLevel ( LOG_TYPE  typ,
LOG_LEVEL  level 
)
static

Change the logging level for a specific logger. Because there are multiple loggers you have to select for which type of logger you want to change the level.

Parameters
typethe type of logger
levelnew level for logging

◆ initializeLogger()

void sim_interface::InterfaceLogger::initializeLogger ( const LoggerConfig con)
static

This function initializes the logger with the given configuration. After calling this function it's possible to log messages and data objects.

Parameters
con- a valid configuration

◆ logEvent()

void sim_interface::InterfaceLogger::logEvent ( sim_interface::SimEvent  event)
static

This function logs the event to the data logfiles. There is no need to define a logging level for this operation.
Please notice, that characters like comma or double quotes causes trouble in CSV files and will be replaced by using standard rules.

Parameters
eventThis event will be logged.

◆ logMessage() [1/2]

void sim_interface::InterfaceLogger::logMessage ( const std::string &  msg,
LOG_LEVEL  level 
)
static

Logs the message with consideration of the log level. Please notice that this function will also log the message into a logfile if the file logger accepts the log level. If you explicitly don't want to log this message into the logfile, please use the function below.

See also
void InterfaceLogger::logMessage(const std::string &msg, LOG_LEVEL level, bool writeToFile)
Parameters
msgmessage that should be logged
levelthe logging level for this message

◆ logMessage() [2/2]

void sim_interface::InterfaceLogger::logMessage ( const std::string &  msg,
LOG_LEVEL  level,
bool  writeToFile 
)
static

Logs the message with consideration of the log level. This function gives you additionally the possibility to prevent that the logger will write your message into the logfile. So if you set the 3rd parameter to 'false' the logger won't log your message into the file even if the log level would have accepted it.

Parameters
msgmessage that should be logged
levelthe logging level for this message
doNotWriteIntoFiletrue, if you don't want to log into the logfile

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