Dev Essential
Loading...
Searching...
No Matches
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
 

Enumerations

enum  LogLevel {
  None = 0 , Error = 10 , Warning = 20 , Info = 30 ,
  Dump = 40 , Debug = Dump , All = 0xFF
}
 

Functions

void addEntry (const LogEntry &entry)
 
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)
 
void setLogger (Logger log)
 
Logger getLogger ()
 
std::string defaultFormat (const LogEntry &entry)
 
void defaultLogger (const LogEntry &entry)
 

Detailed Description

Serves as component for basic logging functionality.

Typedef Documentation

◆ Logger

Logger interface definition

Enumeration Type Documentation

◆ 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.

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.