ADTF
Loading...
Searching...
No Matches
A_UTILS_NS::log Namespace Reference

namespace for default logging functionality within A_UTILS_NS More...

Classes

class  cCurrentThreadDefaultLogChannel
 
class  ILogChannel
 
class  IThreadLocalLogChannelStack
 
struct  tLogEntry
 
struct  tSourceLocation
 

Typedefs

typedef std::function< tVoid(const tLogEntry &sEntry)> logger
 

Enumerations

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

Functions

tVoid add_entry (const tLogEntry &sEntry)
 
tTimeStamp log_get_current_date_time ()
 
tVoid add_entry (tUInt8 nLogLevel, const tChar *strMessage=nullptr, const tChar *strSource=nullptr)
 
tVoid set_logger (logger oLogger)
 
logger get_logger ()
 
tVoid default_logger (const tLogEntry &sEntry)
 
tVoid set_filtered_logging (tUInt8 nMaxLogLevel, logger oLogger=default_logger)
 
void set_module_fallback_log_channel (ILogChannel *pChannel) noexcept
 
void set_module_log_channel_stack (IThreadLocalLogChannelStack *pStack) noexcept
 
ILogChannelget_current_log_channel () noexcept
 

Detailed Description

namespace for default logging functionality within A_UTILS_NS

Typedef Documentation

◆ logger

typedef std::function<tVoid(const tLogEntry& sEntry)> A_UTILS_NS::log::logger

Logger interface definition

Enumeration Type Documentation

◆ tLogLevel

Log levels.

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.

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

◆ 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_current_log_channel()

ILogChannel * A_UTILS_NS::log::get_current_log_channel ( )
noexcept
Returns
The default log channel for the current thread and stack.
Warning
This can only be manipulated via the use of cCurrentThreadDefaultLogChannel in the call stack. Defaults to a generic default log channel per module (shared library) if no other channel is set for the current thread and stack, see set_fallback_log_channel().

◆ get_logger()

logger A_UTILS_NS::log::get_logger ( )

Returns the currently used logger.

Returns
The currently used logger.

◆ log_get_current_date_time()

tTimeStamp A_UTILS_NS::log::log_get_current_date_time ( )

Internal helper to hide cDateTime::GetCurrentDateTime

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

◆ set_logger()

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

Sets the currently used logger.

Parameters
[in]oLoggerThe new logger method.

◆ set_module_fallback_log_channel()

void A_UTILS_NS::log::set_module_fallback_log_channel ( ILogChannel * pChannel)
noexcept

Sets the log channel that is used if no other channel has been pushed onto the stack.

Parameters
[in]pChannelThe channel to use as a fallback.

◆ set_module_log_channel_stack()

void A_UTILS_NS::log::set_module_log_channel_stack ( IThreadLocalLogChannelStack * pStack)
noexcept

Sets the log channel stack that is used by the current module

Parameters
[in]pStackThe stack to use (nullptr -> back to default)