ezEngine  Release 25.03
ezGlobalLog Class Reference

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

#include <Log.h>

Inheritance diagram for ezGlobalLog:

Public Member Functions

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

Static Public Member Functions

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

Friends

class ezLog
 

Detailed Description

This is the standard log system that ezLog 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

◆ SetGlobalLogOverride()

void ezGlobalLog::SetGlobalLogOverride ( ezLogInterface pInterface)
static

ezLogInterfaces are thread_local and therefore a dedicated ezGlobalLog 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 ezGlobalLog 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: