Open 3D Engine EMotionFX Gem API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
MCore::LogManager Class Reference

#include <LogManager.h>

Public Member Functions

 LogManager ()
 
 ~LogManager ()
 
void AddLogCallback (LogCallback *callback)
 
void RemoveLogCallback (size_t index)
 
void RemoveAllByType (uint32 type)
 
void ClearLogCallbacks ()
 
LogCallbackGetLogCallback (size_t index)
 
size_t FindLogCallback (LogCallback *callback) const
 
size_t GetNumLogCallbacks () const
 
void SetLogLevels (LogCallback::ELogLevel logLevels)
 
MCORE_INLINE LogCallback::ELogLevel GetLogLevels () const
 
void InitLogLevels ()
 
void LogMessage (const char *message, LogCallback::ELogLevel logLevel=LogCallback::LOGLEVEL_INFO)
 

Static Public Attributes

static Mutex s_globalMutex
 

Detailed Description

The log manager handles the creation and retrieval of logs for the application. This class is responsible for managing the log callbacks and for logging. Each time you call the log function the manager will iterate through all log callbacks and call their Log() functions so that you can create and add your own log callbacks to the manager. This can be used to for instance log into your in-game console or to some mfc combo box.

Constructor & Destructor Documentation

◆ LogManager()

MCore::LogManager::LogManager ( )

Default constructor.

◆ ~LogManager()

MCore::LogManager::~LogManager ( )

Destructor.

Member Function Documentation

◆ AddLogCallback()

void MCore::LogManager::AddLogCallback ( LogCallback callback)

Add the given callback to the stack. Don't delete the callbacks yourself, the manager will keep track of the callbacks in the stack.

Parameters
callbackThe callback to add.

◆ ClearLogCallbacks()

void MCore::LogManager::ClearLogCallbacks ( )

Remove all log callbacks from the stack.

◆ FindLogCallback()

size_t MCore::LogManager::FindLogCallback ( LogCallback callback) const

Find the index of a given callback.

Parameters
callbackThe callback object to find.
Returns
Returns the index value, or MCORE_INVALIDINDEX32 when not found.

◆ GetLogCallback()

LogCallback * MCore::LogManager::GetLogCallback ( size_t  index)

Return a pointer to the given log callback.

Parameters
indexThe index of the callback.
Returns
A pointer to the callback.

◆ GetLogLevels()

MCORE_INLINE LogCallback::ELogLevel MCore::LogManager::GetLogLevels ( ) const
inline

Get the log levels any of the callbacks will accept and pass through. To check if a log level is enabled by one of the callbacks use logical bitwise and comparison, example: if (GetLogLevels() & LOGLEVEL_EXAMPLE).

Returns
The log levels packed as bit flags which are enabled on the callback.

◆ GetNumLogCallbacks()

size_t MCore::LogManager::GetNumLogCallbacks ( ) const

Return the number of log callbacks managed by this class.

Returns
Number of log callbacks.

◆ InitLogLevels()

void MCore::LogManager::InitLogLevels ( )

Iterate over all callbacks and collect the enabled log levels. This will automatically be called by the LogCallback::SetLogLevels() function. Do not call this function manually.

◆ LogMessage()

void MCore::LogManager::LogMessage ( const char *  message,
LogCallback::ELogLevel  logLevel = LogCallback::LOGLEVEL_INFO 
)

Log a message. This iterates through all callback instances and log to each of them.

Parameters
messageThe message to write into the log file.
logLevelThe log message priority.

◆ RemoveAllByType()

void MCore::LogManager::RemoveAllByType ( uint32  type)

Remove all given log callbacks by type from the stack.

Parameters
typeThe type ID of the log callbacks to remove.

◆ RemoveLogCallback()

void MCore::LogManager::RemoveLogCallback ( size_t  index)

Remove the given callback from the stack.

Parameters
indexThe index of the callback to remove.

◆ SetLogLevels()

void MCore::LogManager::SetLogLevels ( LogCallback::ELogLevel  logLevels)

Force set the log levels of all callbacks in the log manager. To enable multiple log levels use the logical bitwise or operation, example: (LOGLEVEL_WARNING | LOGLEVEL_INFO).

Parameters
logLevelsThe log levels packed as bit flags which are enabled on the callbacks.

Member Data Documentation

◆ s_globalMutex

Mutex MCore::LogManager::s_globalMutex
static

The multithread mutex, used by some global Log functions.


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