te::core::Logger Class Reference

#include <Logger.h>

Public Types

enum  severity_level {
  trace, debug, info, warning,
  error, fatal
}
 

Public Member Functions

void addLogger (const std::string &name, const std::string &filename, std::string format)
 It sets the logger using a default implementation. More...
 
void addLoggerFromFile (const std::string &filename)
 It sets the logger configuration from a given file. More...
 
bool exists (const std::string &name)
 Checks if exists a logger registered with the given name. More...
 
void log (const std::string &message, const std::string &channel, severity_level severity)
 It logs a given string message, channel and severity. More...
 
void removeAllLoggers ()
 It removes all added loggers. More...
 

Static Public Member Functions

static Loggerinstance ()
 It returns a reference to the singleton instance. More...
 

Private Member Functions

 Logger ()
 Singleton constructor must be private or protected. More...
 
 Logger (Logger const &)
 Singleton copy constructor must be private or protected. More...
 
Loggeroperator= (Logger const &)
 Singleton copy assignment operator must be private or protected. More...
 
 ~Logger ()
 Singleton destructor must be private or protected. More...
 

Private Attributes

Impl * m_pimpl
 

Detailed Description

Definition at line 59 of file Logger.h.

Member Enumeration Documentation

Enumerator
trace 
debug 
info 
warning 
error 
fatal 

Definition at line 68 of file Logger.h.

Constructor & Destructor Documentation

te::core::Logger::Logger ( )
private

Singleton constructor must be private or protected.

te::core::Logger::~Logger ( )
private

Singleton destructor must be private or protected.

te::core::Logger::Logger ( Logger const &  )
private

Singleton copy constructor must be private or protected.

Member Function Documentation

void te::core::Logger::addLogger ( const std::string &  name,
const std::string &  filename,
std::string  format 
)

It sets the logger using a default implementation.

Parameters
nameThe name of the logger.
filenameThe name of the log file.
formatThe format string of the logger.
Exceptions
te::InvalidArgumentExceptionIf the logger name is empty or already registered
Note
The logs will be stored in the given file name. If the file already exists, the logs will be appended to the end of the file.
void te::core::Logger::addLoggerFromFile ( const std::string &  filename)

It sets the logger configuration from a given file.

Parameters
filenameThe name of the configuration file.
Exceptions
std::exceptionIf the configuration file is doesn't load.
bool te::core::Logger::exists ( const std::string &  name)

Checks if exists a logger registered with the given name.

Parameters
nameThe name to be checked.
Returns
True if a logger with the given name, false if not.
static Logger& te::core::Logger::instance ( )
static

It returns a reference to the singleton instance.

Returns
A reference to the singleton instance.
void te::core::Logger::log ( const std::string &  message,
const std::string &  channel,
severity_level  severity 
)

It logs a given string message, channel and severity.

Parameters
messageThe string message to be logged.
channelThe channel name that will receive the message.
severityThe severity of the logged message.
Logger& te::core::Logger::operator= ( Logger const &  )
private

Singleton copy assignment operator must be private or protected.

void te::core::Logger::removeAllLoggers ( )

It removes all added loggers.

Member Data Documentation

Impl* te::core::Logger::m_pimpl
private

Definition at line 147 of file Logger.h.


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