ADTF  3.18.2
a_util::logging Namespace Reference

Serves as component for basic logging functionality. More...

Classes

struct  LogEntry
 A log entry. More...
 

Typedefs

typedef experimental::UnaryDelegate< void, const LogEntry & > Logger
 Logger interface definition.
 

Enumerations

enum  LogLevel {
  None = 0 , Error = 10 , Warning = 20 , Info = 30 ,
  Dump = 40 , Debug = Dump , All = 0xFF
}
 Usable log levels for LogEntry::log_level. More...
 

Functions

void addEntry (const LogEntry &entry)
 Adds a new log entry to the current logger. More...
 
void addEntry (std::uint8_t log_level, const std::string &message=a_util::strings::empty_string, const std::string &source=a_util::strings::empty_string)
 Adds a new log entry to the current logger. More...
 
void setLogger (Logger log)
 Sets the currently used logger. More...
 
Logger getLogger ()
 Get the currently used logger. More...
 
std::string defaultFormat (const LogEntry &entry)
 Get the default string representation of a log entry. More...
 
void defaultLogger (const LogEntry &entry)
 Default logging method, that writes log messages to stdout. More...
 

Detailed Description

Serves as component for basic logging functionality.

Enumeration Type Documentation

◆ LogLevel

enum LogLevel

Usable log levels for LogEntry::log_level.

Severity ordered from high to low.

Enumerator
None 

Log nothing.

Error 

Log errors only.

Warning 

Log errors and warnings.

Info 

Log errors, warnings and info messages.

Dump 

Log errors, warnings, info and debug messages.

Debug 

Same as Dump.

All 

Log all messages.

Definition at line 30 of file workspace/conan/dev_essential/1.3.3/dw/stable/package/37682420cd166e229516a41c8d6a139a0b13e1e1/include/a_util/logging/log.h.

Function Documentation

◆ addEntry() [1/2]

void a_util::logging::addEntry ( const LogEntry entry)

Adds a new log entry to the current logger.

Parameters
[in]entryThe new log entry.

◆ addEntry() [2/2]

void a_util::logging::addEntry ( std::uint8_t  log_level,
const std::string &  message = a_util::strings::empty_string,
const std::string &  source = a_util::strings::empty_string 
)

Adds a new log entry to the current logger.

Automatically timestamps the entry.

Parameters
[in]log_levelThe severity, LogLevel.
[in]messageThe message text (optional)
[in]sourceA string describing the source location (optional).

◆ defaultFormat()

std::string a_util::logging::defaultFormat ( const LogEntry entry)

Get the default string representation of a log entry.

Parameters
[in]entryThe log entry.
Returns
the string representation of the log entry.

◆ defaultLogger()

void a_util::logging::defaultLogger ( const LogEntry entry)

Default logging method, that writes log messages to stdout.

Parameters
[in]entryThe log entry.

◆ getLogger()

Logger a_util::logging::getLogger ( )

Get the currently used logger.

Returns
The currently used logger.

◆ setLogger()

void a_util::logging::setLogger ( Logger  log)

Sets the currently used logger.

Parameters
[in]logThe new logger method.