SA_Logger
Sapphire's Suite's C++ Logger.
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SA::LoggerBase Class Referenceabstract

Logger base class implementation. More...

#include <LoggerBase.hpp>

Inheritance diagram for SA::LoggerBase:
SA::Logger SA::LoggerThread

Public Member Functions

virtual ~LoggerBase ()
 Destructor Destroy all created log streams.
 
virtual void Log (SA::Log _log)
 Push a new log in logger.
 
template<typename ExcepT >
void Assert (ExcepT _exc)
 Process exception.
 
template<typename StreamT , typename... Args>
StreamT & CreateSteam (Args &&... _args)
 Create a new stream to output in.
 
template<typename StreamT >
bool DestroyStream (StreamT &_stream, bool _bFlush=true)
 Destroy a previously created stream.
 
virtual void ClearStreams (bool _bFlush=true)
 
virtual void Flush ()
 Force logger to flush all streams.
 
virtual void EnableLogLevel (LogLevel _level)
 Enable LogLevel for all registered streams.
 
virtual void DisableLogLevel (LogLevel _level)
 Disable LogLevel for all registered streams.
 
virtual void EnableLogChannel (const std::wstring &_channel)
 Enable LogChannel for all registered streams.
 
virtual void DisableLogChannel (const std::wstring &_channel)
 Disable LogChannel for all registered streams.
 
virtual void IncrementFrameNum ()=0
 Increment current registered frame number.
 
virtual uint32_t GetFrameNum () const =0
 Get current registered frame number.
 

Protected Member Functions

virtual void ProcessLog (const SA::Log &_log, bool _bForce=false)
 Process log to output.
 
virtual void RegisterStream (ALogStream *_stream)
 Register a stream to output.
 
virtual bool UnregisterStream (ALogStream *_stream)
 Unregister a stream from output.
 

Protected Attributes

std::list< ALogStream * > mStreams
 Registered output streams.
 

Detailed Description

Logger base class implementation.

Member Function Documentation

◆ Assert()

template<typename ExcepT >
void SA::LoggerBase::Assert ( ExcepT _exc)

Process exception.

Log assertion on success, otherwise throw exception. Use SA_ASSERT as helper call.

Template Parameters
ExcepTException type.
Parameters
[in]_excexception to process.

◆ ClearStreams()

virtual void SA::LoggerBase::ClearStreams ( bool _bFlush = true)
virtual

Destroy all streams.

Parameters
_bFlushShould flush stream before destroy.

Reimplemented in SA::LoggerThread.

◆ CreateSteam()

template<typename StreamT , typename... Args>
StreamT & SA::LoggerBase::CreateSteam ( Args &&... _args)

Create a new stream to output in.

Template Parameters
StreamTType of stream to create.
Args...Argument variadic types to construct stream.
Parameters
[in]_argsArguments to construct stream.
Returns
Newly created stream.

◆ DestroyStream()

template<typename StreamT >
bool SA::LoggerBase::DestroyStream ( StreamT & _stream,
bool _bFlush = true )

Destroy a previously created stream.

Template Parameters
StreamTType of stream to destroy.
Parameters
_streamStream variable to destroy.
_bFlushShould flush stream before destroy.
Returns
true on destroy success.

◆ DisableLogChannel()

virtual void SA::LoggerBase::DisableLogChannel ( const std::wstring & _channel)
virtual

Disable LogChannel for all registered streams.

Parameters
[in]_channelChannel to disable.

Reimplemented in SA::LoggerThread.

◆ DisableLogLevel()

virtual void SA::LoggerBase::DisableLogLevel ( LogLevel _level)
virtual

Disable LogLevel for all registered streams.

Parameters
[in]_levelLevel to disable.

Reimplemented in SA::LoggerThread.

◆ EnableLogChannel()

virtual void SA::LoggerBase::EnableLogChannel ( const std::wstring & _channel)
virtual

Enable LogChannel for all registered streams.

Parameters
[in]_channelChannel to enable.

Reimplemented in SA::LoggerThread.

◆ EnableLogLevel()

virtual void SA::LoggerBase::EnableLogLevel ( LogLevel _level)
virtual

Enable LogLevel for all registered streams.

Parameters
[in]_levelLevel to enable.

Reimplemented in SA::LoggerThread.

◆ Flush()

virtual void SA::LoggerBase::Flush ( )
virtual

Force logger to flush all streams.

Reimplemented in SA::LoggerThread.

◆ GetFrameNum()

virtual uint32_t SA::LoggerBase::GetFrameNum ( ) const
pure virtual

Get current registered frame number.

Implemented in SA::Logger, and SA::LoggerThread.

◆ IncrementFrameNum()

virtual void SA::LoggerBase::IncrementFrameNum ( )
pure virtual

Increment current registered frame number.

Implemented in SA::Logger, and SA::LoggerThread.

◆ Log()

virtual void SA::LoggerBase::Log ( SA::Log _log)
virtual

Push a new log in logger.

Parameters
[in]_logLog to push.

Reimplemented in SA::LoggerThread.

◆ ProcessLog()

virtual void SA::LoggerBase::ProcessLog ( const SA::Log & _log,
bool _bForce = false )
protectedvirtual

Process log to output.

Parameters
[in]_logLog to process.
[in]_bForceShould force log process. Default is false.

◆ RegisterStream()

virtual void SA::LoggerBase::RegisterStream ( ALogStream * _stream)
protectedvirtual

Register a stream to output.

Parameters
[in]_streamStream to register.

◆ UnregisterStream()

virtual bool SA::LoggerBase::UnregisterStream ( ALogStream * _stream)
protectedvirtual

Unregister a stream from output.

Parameters
[in]_streamStream to unregister.
Returns
true on success.

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