ADTF
A_UTILS_NS::log Namespace Reference

namespace for default logging functionality within A_UTILS_NS More...

Classes

struct  tLogEntry
 A log entry. More...
 

Typedefs

typedef std::function< tVoid(const tLogEntry &sEntry)> logger
 Logger interface definition.
 

Enumerations

enum  tLogLevel {
  None = 0 , Error = 10 , Warning = 20 , Info = 30 ,
  Detail = 35 , Dump = 40 , Debug = Dump , All = 0xFF
}
 Log levels.
 

Functions

tVoid add_entry (const tLogEntry &sEntry)
 Adds a new log entry to the current logger. More...
 
tVoid add_entry (tUInt8 nLogLevel, const tChar *strMessage=nullptr, const tChar *strSource=nullptr)
 Adds a new log entry to the current logger. More...
 
tVoid set_logger (logger oLogger)
 Sets the currently used logger. More...
 
logger get_logger ()
 Returns the currently used logger. More...
 
cString default_format (const tLogEntry &sEntry)
 Returns the default string representation of a log entry. More...
 
tVoid default_logger (const tLogEntry &sEntry)
 Default logging method, that writes log messages to stdout. More...
 
tVoid set_filtered_logging (tUInt8 nMaxLogLevel, logger oLogger=default_logger)
 Convenience method to filter log messages. More...
 

Detailed Description

namespace for default logging functionality within A_UTILS_NS

Function Documentation

◆ add_entry() [1/2]

tVoid A_UTILS_NS::log::add_entry ( const tLogEntry sEntry)

Adds a new log entry to the current logger.

Parameters
[in]sEntryThe new log entry.

Referenced by add_entry().

◆ add_entry() [2/2]

tVoid A_UTILS_NS::log::add_entry ( tUInt8  nLogLevel,
const tChar strMessage = nullptr,
const tChar strSource = nullptr 
)
inline

Adds a new log entry to the current logger.

Automatically timestamps the entry.

Parameters
[in]nLogLevelThe severity, tLogLevel.
[in]strMessageThe message text (optional)
[in]strSourceA string describing the source location (optional).

Definition at line 57 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/std/log.h.

References add_entry(), cDateTime::GetCurrentDateTime(), and cDateTime::ToTimeStamp().

◆ default_format()

cString A_UTILS_NS::log::default_format ( const tLogEntry sEntry)

Returns the default string representation of a log entry.

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

◆ default_logger()

tVoid A_UTILS_NS::log::default_logger ( const tLogEntry sEntry)

Default logging method, that writes log messages to stdout.

Parameters
[in]sEntryThe log entry.

◆ get_logger()

logger A_UTILS_NS::log::get_logger ( )

Returns the currently used logger.

Returns
The currently used logger.

◆ set_filtered_logging()

tVoid A_UTILS_NS::log::set_filtered_logging ( tUInt8  nMaxLogLevel,
logger  oLogger = default_logger 
)
inline

Convenience method to filter log messages.

Parameters
[in]nMaxLogLevelThe maximum log level.
[in]oLoggerThe logger that will be used.

Definition at line 99 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/std/log.h.

References tLogEntry::nLogLevel, and set_logger().

◆ set_logger()

tVoid A_UTILS_NS::log::set_logger ( logger  oLogger)

Sets the currently used logger.

Parameters
[in]oLoggerThe new logger method.

Referenced by set_filtered_logging().