Loading...
Searching...
No Matches
CLogger Class Reference

Class for loggin information to file or console. More...

`#include <src/common/logger.h>`

Inheritance diagram for CLogger:
[legend]

## Public Member Functions

void | Message (const char *str,...)
void | Trace (const char *str,...)
void | Debug (const char *str,...)
void | Info (const char *str,...)
void | Warn (const char *str,...)
void | Error (const char *str,...)
void | Log (LogLevel logLevel, const char *str,...)
void | AddOutput (FILE *file)
void | SetLogLevel (LogLevel level)

## Static Public Member Functions

static bool | ParseLogLevel (const std::string &str, LogLevel &logLevel)
Static Public Member Functions inherited from CSingleton< CLogger >
static CLogger & | GetInstance ()
static CLogger * | GetInstancePointer ()
static bool | IsCreated ()

## Additional Inherited Members

Static Protected Attributes inherited from CSingleton< CLogger >
static CLogger * | m_instance

## Detailed Description

Class for loggin information to file or console.

## Member Function Documentation

## Message()

void CLogger::Message | ( | const char * | str,
|  |  | ... )

Write message to console or file

Parameters

  str | - message to write
  ... | - additional arguments

## Trace()

void CLogger::Trace | ( | const char * | str,
|  |  | ... )

Write message to console or file with LOG_TRACE level

Parameters

  str | - message to write
  ... | - additional arguments

## Debug()

void CLogger::Debug | ( | const char * | str,
|  |  | ... )

Write message to console or file with LOG_DEBUG level

Parameters

  str | - message to write
  ... | - additional arguments

## Info()

void CLogger::Info | ( | const char * | str,
|  |  | ... )

Write message to console or file with LOG_INFO level

Parameters

  str | - message to write
  ... | - additional arguments

## Warn()

void CLogger::Warn | ( | const char * | str,
|  |  | ... )

Write message to console or file with LOG_WARN level

Parameters

  str | - message to write
  ... | - additional arguments

## Error()

void CLogger::Error | ( | const char * | str,
|  |  | ... )

Write message to console or file with LOG_ERROR level

Parameters

  str | - message to write
  ... | - additional arguments

## Log()

void CLogger::Log | ( | LogLevel | logLevel,
|  | const char * | str,
|  |  | ... )

Write message to console or file with given log level

Parameters

  logLevel | - log level
  str | - message to write
  ... | - additional arguments

## AddOutput()

void CLogger::AddOutput | ( | FILE * | file | ) |

Set output file to write logs to The given file will be automatically closed when the logger exits

Parameters

  file | - file pointer to write to

## SetLogLevel()

void CLogger::SetLogLevel | ( | LogLevel | level | ) |

Set log level. Logs with level below will not be shown

Parameters

  level | - minimum log level to write

## ParseLogLevel()

bool CLogger::ParseLogLevel | ( | const std::string & | str,
|  | LogLevel & | logLevel )

static

Parses string as a log level

Parameters

  str | string to parse
  logLevel | result log level

Valid values are "trace", "debug", "info", "warn", "error" and "none". On invalid value, returns `false`.

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

- src/common/logger.h
- src/common/logger.cpp