Berserk
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
Logger Class Referencefinal

Simpler engine logger class to maintain text log. More...

#include <Logger.hpp>

Classes

struct  Entry
 Log entry. More...
 

Public Types

enum class  Level { Info = 0 , Warning = 1 , Error = 2 }
 Level of accepted messages. More...
 
using Listener = std::function< void(const Entry &)>
 

Public Member Functions

BRK_API Logger ()=default
 
BRK_API void SetLevel (Level level)
 
BRK_API void SetSize (size_t size=DEFAULT_SIZE)
 
BRK_API void SetActive (bool active=true)
 
BRK_API void AddListener (Listener listener)
 
BRK_API void Log (Level level, String message, String function="", String file="", size_t line=0)
 
BRK_API void LogInfo (String message, String function="", String file="", size_t line=0)
 
BRK_API void LogWarning (String message, String function="", String file="", size_t line=0)
 
BRK_API void LogError (String message, String function="", String file="", size_t line=0)
 
BRK_API Level GetLevel () const
 
BRK_API bool IsActive () const
 
BRK_API bool ShouldLog (Level level) const
 

Static Public Member Functions

static BRK_API LoggerInstance ()
 

Static Public Attributes

static const size_t DEFAULT_SIZE = 100
 

Detailed Description

Simpler engine logger class to maintain text log.

Member Typedef Documentation

◆ Listener

using Logger::Listener = std::function<void(const Entry &)>

Member Enumeration Documentation

◆ Level

enum Logger::Level
strong

Level of accepted messages.

Enumerator
Info 

Useful for debugging and prototyping things

Warning 

Code correct, by we need attract user attention

Error 

Notify about error, invalid program state

Constructor & Destructor Documentation

◆ Logger()

BRK_API Logger::Logger ( )
default

Member Function Documentation

◆ AddListener()

void Logger::AddListener ( Logger::Listener  listener)

◆ GetLevel()

Logger::Level Logger::GetLevel ( ) const

◆ Instance()

Logger & Logger::Instance ( )
static

◆ IsActive()

bool Logger::IsActive ( ) const

◆ Log()

void Logger::Log ( Logger::Level  level,
String  message,
String  function = "",
String  file = "",
size_t  line = 0 
)

◆ LogError()

void Logger::LogError ( String  message,
String  function = "",
String  file = "",
size_t  line = 0 
)

◆ LogInfo()

void Logger::LogInfo ( String  message,
String  function = "",
String  file = "",
size_t  line = 0 
)

◆ LogWarning()

void Logger::LogWarning ( String  message,
String  function = "",
String  file = "",
size_t  line = 0 
)

◆ SetActive()

void Logger::SetActive ( bool  active = true)

◆ SetLevel()

BRK_NS_BEGIN void Logger::SetLevel ( Level  level)

◆ SetSize()

void Logger::SetSize ( size_t  size = DEFAULT_SIZE)

◆ ShouldLog()

bool Logger::ShouldLog ( Level  level) const

Member Data Documentation

◆ DEFAULT_SIZE

const size_t Logger::DEFAULT_SIZE = 100
static

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