XII Release 0.1.0
Loading...
Searching...
No Matches
xiiGlobalLog Class Reference

This is the standard log system that xiiLog sends all messages to. More...

#include <Log.h>

Inheritance diagram for xiiGlobalLog:
[legend]

Public Member Functions

virtual void HandleLogMessage (const xiiLoggingEventData &le) override
 Override this function to handle logging events.
 
- Public Member Functions inherited from xiiLogInterface
XII_ALWAYS_INLINE void SetLogLevel (xiiLogMsgType::Enum logLevel)
 LogLevel is between xiiLogEventType::None and xiiLogEventType::All and defines which messages will be logged and which will be filtered out.
 
XII_ALWAYS_INLINE xiiLogMsgType::Enum GetLogLevel ()
 Returns the currently set log level.
 

Static Public Member Functions

static xiiEventSubscriptionID AddLogWriter (xiiLoggingEvent::Handler handler)
 Allows to register a function as an event receiver.
 
static void RemoveLogWriter (xiiLoggingEvent::Handler handler)
 Unregisters a previously registered receiver. It is an error to unregister a receiver that was not registered.
 
static void RemoveLogWriter (xiiEventSubscriptionID &ref_subscriptionID)
 Unregisters a previously registered receiver. It is an error to unregister a receiver that was not registered.
 
static xiiUInt32 GetMessageCount (xiiLogMsgType::Enum messageType)
 Returns how many message of the given type occurred.
 
static void SetGlobalLogOverride (xiiLogInterface *pInterface)
 

Friends

class xiiLog
 

Detailed Description

This is the standard log system that xiiLog sends all messages to.

It allows to register log writers, such that you can be informed of all log messages and write them to different outputs.

Member Function Documentation

◆ HandleLogMessage()

void xiiGlobalLog::HandleLogMessage ( const xiiLoggingEventData & le)
overridevirtual

Override this function to handle logging events.

Implements xiiLogInterface.

◆ SetGlobalLogOverride()

void xiiGlobalLog::SetGlobalLogOverride ( xiiLogInterface * pInterface)
static

xiiLogInterfaces are thread_local and therefore a dedicated xiiGlobalLog is created per thread. Especially during testing one may want to replace the log system everywhere, to catch certain messages, no matter on which thread they happen. Unfortunately that is not so easy, as one cannot modify the thread_local system for all the other threads. This function makes it possible to at least force all messages that go through any xiiGlobalLog to be redirected to one other log interface. Be aware that that interface has to be thread-safe. Also, only one override can be set at a time, SetGlobalLogOverride() will assert that no other override is set at the moment.


The documentation for this class was generated from the following files: