WoW Model Viewer
Your premiere tool for viewing, equipping and animating World of Warcraft models.
Loading...
Searching...
No Matches
WMVLog::Logger Class Reference

Singleton logging facility that dispatches formatted messages to LogOutput sinks. More...

#include <Logger.h>

Inheritance diagram for WMVLog::Logger:
[legend]
Collaboration diagram for WMVLog::Logger:
[legend]

Public Types

enum  LogType { INFO_LOG = 0 , WARNING_LOG , ERROR_LOG , FATAL_LOG }
 
- Public Types inherited from Container< LogOutput >
typedef std::unordered_set< LogOutput * >::iterator iterator
 

Public Member Functions

void dispatchLog (int type, const std::string &msg)
 Send a pre-formatted message to all registered outputs.
 
LogStream operator() (Logger::LogType type)
 Create a LogStream for the given severity level.
 
- Public Member Functions inherited from Container< LogOutput >
 Container ()
 
virtual ~Container ()
 
virtual bool addChild (LogOutput *child)
 
virtual bool removeChild (LogOutput *child)
 
void removeAllChildren ()
 
virtual void onChildAdded (LogOutput *)
 
virtual void onChildRemoved (LogOutput *)
 
int removeAllChildrenOfType ()
 
unsigned int nbChildren () const
 
bool findChildComponent (Component *child, bool recursive=false)
 
ComponentgetChild (unsigned int index)
 
const ComponentgetChild (unsigned int index) const
 
iterator begin ()
 
iterator end ()
 
- Public Member Functions inherited from Component
 Component ()
 
virtual ~Component ()
 
virtual bool addChild (Component *)
 Add a child component to this node.
 
virtual bool removeChild (Component *)
 Remove a child component from this node.
 
void setParentComponent (Component *)
 Set the parent of this component.
 
virtual void onParentSet (Component *)
 Called after the parent has been set; override for custom logic.
 
const Componentparent () const
 Get the parent component (const).
 
Componentparent ()
 Get the parent component.
 
template<class DataType >
const DataType * firstParentOfType ()
 Walk up the parent chain and return the first ancestor of the given type.
 
void ref ()
 Increment the reference counter.
 
void unref ()
 Decrement the reference counter; deletes this when it reaches zero.
 
void setName (const std::string &name)
 
std::string name () const
 
virtual void onNameChanged ()
 
void print (int l_depth=0)
 
virtual void doPrint ()
 
void copy (const Component &component, bool)
 

Static Public Member Functions

static Loggerinstance ()
 
static void init ()
 Initialise the logging subsystem (creates console and file outputs).
 
static std::string formatLog (int type, const std::string &msg)
 Format a log message with a severity prefix and timestamp.
 

Private Member Functions

 Logger ()
 
 Logger (const Logger &)=delete
 
Loggeroperator= (const Logger &)=delete
 

Static Private Attributes

static Loggerm_instance = nullptr
 

Detailed Description

Singleton logging facility that dispatches formatted messages to LogOutput sinks.

Access via the LOGGER macro or the convenience macros LOG_INFO, LOG_ERROR, LOG_WARNING, and LOG_FATAL. Outputs are added as children (see Container).

Definition at line 57 of file Logger.h.

Member Enumeration Documentation

◆ LogType

Enumerator
INFO_LOG 
WARNING_LOG 
ERROR_LOG 
FATAL_LOG 

Definition at line 60 of file Logger.h.

Constructor & Destructor Documentation

◆ Logger() [1/2]

Logger::Logger ( )
private

Definition at line 15 of file Logger.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Logger() [2/2]

WMVLog::Logger::Logger ( const Logger )
privatedelete

Member Function Documentation

◆ dispatchLog()

void Logger::dispatchLog ( int  type,
const std::string &  msg 
)

Send a pre-formatted message to all registered outputs.

Definition at line 24 of file Logger.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ formatLog()

std::string Logger::formatLog ( int  type,
const std::string &  msg 
)
static

Format a log message with a severity prefix and timestamp.

Definition at line 31 of file Logger.cpp.

Here is the caller graph for this function:

◆ init()

void Logger::init ( )
static

Initialise the logging subsystem (creates console and file outputs).

Definition at line 20 of file Logger.cpp.

Here is the caller graph for this function:

◆ instance()

static Logger & WMVLog::Logger::instance ( )
inlinestatic

Definition at line 68 of file Logger.h.

Here is the call graph for this function:

◆ operator()()

LogStream Logger::operator() ( Logger::LogType  type)

Create a LogStream for the given severity level.

Definition at line 63 of file Logger.cpp.

◆ operator=()

Logger & WMVLog::Logger::operator= ( const Logger )
privatedelete

Member Data Documentation

◆ m_instance

Logger * Logger::m_instance = nullptr
staticprivate

Definition at line 93 of file Logger.h.


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