btftoolchain
helper::logging Namespace Reference

Classes

class  GlobalLogger
 Class for the Logger. More...
 

Enumerations

enum class  LogLevel { none = 0 , error = 1 , warning = 2 , trace = 3 }
 Currently supported log levels for the logging feature. More...
 

Functions

void initLogging (LogLevel log_level, const std::string &log_file_path="")
 Initalizes the logging feature. More...
 
void flush ()
 Flushes the log. More...
 
std::ostream & printError (const source_location location=source_location::current())
 Writes an error message to the log. More...
 
std::ostream & printWarning (const source_location location=source_location::current())
 Writes a warning message to the log. More...
 
std::ostream & printTrace (const source_location location=source_location::current())
 Writes a trace message to the log. More...
 
std::ostream & printLog (LogLevel log_level, const source_location location)
 Prints a log message to the log. More...
 
std::string logLevelToString (LogLevel log_level)
 Converts the enum LogLevel into string. More...
 
std::string stripSourceFileName (const std::string &file_name)
 Gets the source file name out of the path. More...
 

Enumeration Type Documentation

◆ LogLevel

Currently supported log levels for the logging feature.

Enumerator
none 

No log level is selected.

error 

Adds "Error" before the log message.

warning 

Adds "Warning" before the log message.

trace 

Adds "Trace" before the log message.

Function Documentation

◆ flush()

void helper::logging::flush ( )

Flushes the log.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initLogging()

void helper::logging::initLogging ( LogLevel  log_level,
const std::string &  log_file_path = "" 
)

Initalizes the logging feature.

Parameters
[in]log_levelThe max log level that will be written to the log.
[in]log_file_pathThe file path to the log file. If it is empty cout is used.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logLevelToString()

std::string helper::logging::logLevelToString ( LogLevel  log_level)

Converts the enum LogLevel into string.

Parameters
[in]log_levelLogLevel enum that will be converted.
Returns
LogLevel as string.
Here is the caller graph for this function:

◆ printError()

std::ostream & helper::logging::printError ( const source_location  location = source_location::current())

Writes an error message to the log.

Parameters
[in]locationThe source code location. Using the default value gives the current source code location.
Returns
An ostream with the error message to the log.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printLog()

std::ostream & helper::logging::printLog ( LogLevel  log_level,
const source_location  location 
)

Prints a log message to the log.

Parameters
[in]log_levelThe log level of the message to be written.
[in]locationThe source code location. Using the default value gives the current source code location.
Returns
An ostream with the log message to the log.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printTrace()

std::ostream & helper::logging::printTrace ( const source_location  location = source_location::current())

Writes a trace message to the log.

Parameters
[in]locationThe source code location. Using the default value gives the current source code location.
Returns
An ostream with the trace message to the log.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ printWarning()

std::ostream & helper::logging::printWarning ( const source_location  location = source_location::current())

Writes a warning message to the log.

Parameters
[in]locationThe source code location. Using the default value gives the current source code location.
Returns
An ostream with the warning message to the log.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ stripSourceFileName()

std::string helper::logging::stripSourceFileName ( const std::string &  file_name)

Gets the source file name out of the path.

Parameters
[in]file_nameSource file name with the complete path.
Returns
Source file name.
Here is the caller graph for this function: