EHS
Loading...
Searching...
No Matches
ehs::Log Class Reference

#include <Log.h>

Public Member Functions

 Log ()
 Default members initialization.
 
 Log (LogType type, const std::initializer_list< Str_8 > &tags, UInt_64 code, Str_8 msg)
 
 Log (LogType type, Array< Str_8 > tags, UInt_64 code, Str_8 msg)
 
 Log (Log &&log) noexcept
 
 Log (const Log &log)
 
Logoperator= (Log &&log) noexcept
 
Logoperator= (const Log &log)
 
LogType GetType () const
 
bool HasTags (const std::initializer_list< Str_8 > &tags) const
 
bool HasTags (const Array< Str_8 > &tags) const
 
bool HasTag (const Str_8 &tag) const
 
const Array< Str_8 > & GetTags () const
 
UInt_64 GetCode () const
 
Str_8 GetMsg () const
 
Str_8 ToStr () const
 
bool IsValid () const
 

Static Public Member Functions

static void SetRaisedCallback (LogRaisedCb newCb)
 
static void SetOutputCallback (LogOutputCb newCb)
 
static void OnExit ()
 
static void Raise (Log log)
 
static Log GetLastLog ()
 Retrieves the last log raised.
 
static void EnableImmediateMode (bool enable)
 

Detailed Description

A helper class for holding error information and handling them.

Template Parameters
TThe character data type to use.
NThe number data type to use.

Constructor & Destructor Documentation

◆ Log() [1/5]

ehs::Log::Log ( )

Default members initialization.

◆ Log() [2/5]

ehs::Log::Log ( LogType type,
const std::initializer_list< Str_8 > & tags,
UInt_64 code,
Str_8 msg )

Initializes members with the given information.

Parameters
[in]tagsThe tags to associate this log with.
[in]codeThe unique code to use.
[in]msgDetailed information about what happened.

◆ Log() [3/5]

ehs::Log::Log ( LogType type,
Array< Str_8 > tags,
UInt_64 code,
Str_8 msg )

Initializes members with the given information.

Parameters
[in]tagsThe tags to associate this log with.
[in]codeThe unique code to use.
[in]msgDetailed information about what happened.

◆ Log() [4/5]

ehs::Log::Log ( Log && log)
noexcept

◆ Log() [5/5]

ehs::Log::Log ( const Log & log)

Copies all members from the given log.

Parameters
[in]logThe log to copy from.

Member Function Documentation

◆ EnableImmediateMode()

void ehs::Log::EnableImmediateMode ( bool enable)
static

◆ GetCode()

UInt_64 ehs::Log::GetCode ( ) const

◆ GetLastLog()

Log ehs::Log::GetLastLog ( )
static

Retrieves the last log raised.

◆ GetMsg()

Str_8 ehs::Log::GetMsg ( ) const

Retrieves the detailed error message string.

Returns
The error message.

◆ GetTags()

const Array< Str_8 > & ehs::Log::GetTags ( ) const

Retrieves all the tags.

Returns
The result.

◆ GetType()

LogType ehs::Log::GetType ( ) const

◆ HasTag()

bool ehs::Log::HasTag ( const Str_8 & tag) const

Checks whether or not this log has the given tag.

Parameters
[in]tagThe tag to look for.
Returns
True if tag was found, otherwise false.

◆ HasTags() [1/2]

bool ehs::Log::HasTags ( const Array< Str_8 > & tags) const

Checks whether or not this log has the given tags.

Parameters
[in]tagsThe tags to look for.
Returns
True if all tags were found, otherwise false.

◆ HasTags() [2/2]

bool ehs::Log::HasTags ( const std::initializer_list< Str_8 > & tags) const

Checks whether or not this log has the given tags.

Parameters
[in]tagsThe tags to look for.
Returns
True if all tags were found, otherwise false.

◆ IsValid()

bool ehs::Log::IsValid ( ) const

Retrieves whether or not this is a valid object.

Returns
The result.
Note
To be a valid object it must have one or more tags and a message size greater than zero.

◆ OnExit()

void ehs::Log::OnExit ( )
static

◆ operator=() [1/2]

Log & ehs::Log::operator= ( const Log & log)

Copies all members from the given log.

Parameters
[in]logThe log to copy from.
Returns
The log that has been assigned to.

◆ operator=() [2/2]

Log & ehs::Log::operator= ( Log && log)
noexcept

◆ Raise()

void ehs::Log::Raise ( Log log)
static

◆ SetOutputCallback()

void ehs::Log::SetOutputCallback ( LogOutputCb newCb)
static

◆ SetRaisedCallback()

void ehs::Log::SetRaisedCallback ( LogRaisedCb newCb)
static

◆ ToStr()

Str_8 ehs::Log::ToStr ( ) const

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