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 58 of file Logger.h.

Member Enumeration Documentation

Enumerator
trace 
debug 
info 
warning 
error 
fatal 

Definition at line 67 of file Logger.h.

Constructor & Destructor Documentation

Logger::Logger ( )
private

Singleton constructor must be private or protected.

Definition at line 123 of file Logger.cpp.

References m_pimpl.

Logger::~Logger ( )
private

Singleton destructor must be private or protected.

Definition at line 139 of file Logger.cpp.

References m_pimpl.

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

Singleton copy constructor must be private or protected.

Member Function Documentation

void 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.

Definition at line 84 of file Logger.cpp.

References exists(), m_pimpl, and TE_TR.

void 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.

Definition at line 66 of file Logger.cpp.

References exists(), m_pimpl, and TE_TR.

bool 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.

Definition at line 110 of file Logger.cpp.

References m_pimpl.

Referenced by addLogger(), and addLoggerFromFile().

static Logger& te::core::Logger::instance ( )
static

It returns a reference to the singleton instance.

Returns
A reference to the singleton instance.

Referenced by BOOST_AUTO_TEST_SUITE(), and te::qt::af::ApplicationController::finalize().

void 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.

Definition at line 145 of file Logger.cpp.

References m_pimpl, and TE_TR.

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

Singleton copy assignment operator must be private or protected.

void Logger::removeAllLoggers ( )

It removes all added loggers.

Definition at line 117 of file Logger.cpp.

References m_pimpl.

Referenced by te::qt::af::ApplicationController::finalize().

Member Data Documentation

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

Definition at line 146 of file Logger.h.

Referenced by addLogger(), addLoggerFromFile(), exists(), log(), Logger(), removeAllLoggers(), and ~Logger().


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