log4tango  5.0.1
Public Member Functions | Protected Member Functions | List of all members
log4tango::Logger Class Reference

#include <Logger.hh>

Inheritance diagram for log4tango::Logger:
log4tango::AppenderAttachable

Public Member Functions

 Logger (const std::string &name, Level::Value level=Level::OFF)
 Constructor. More...
 
virtual ~Logger ()
 Destructor. More...
 
const std::string & get_name () const
 Return the logger name. More...
 
void set_level (Level::Value level)
 Set the level of this Logger (silently ignores invalid values) More...
 
Level::Value get_level () const
 Returns the assigned Level, if any, for this Logger. More...
 
bool is_level_enabled (Level::Value level) const
 Returns true if the level of the Logger is equal to or higher than given level. More...
 
void log (Level::Value level, const char *string_format,...)
 Log a message with the specified level. More...
 
void log (Level::Value level, const std::string &message)
 Log a message with the specified level. More...
 
void log_unconditionally (Level::Value level, const char *string_format,...)
 Log a message with the specified level without level checking. More...
 
void log_unconditionally (Level::Value level, const std::string &message)
 Log a message with the specified level without level checking. More...
 
void debug (const char *string_format,...)
 Log a message with debug level. More...
 
void debug (const std::string &message)
 Log a message with debug level. More...
 
bool is_debug_enabled (void) const
 Return true if the Logger will log messages with level DEBUG. More...
 
LoggerStream debug_stream (void)
 Return a LoggerStream with level DEBUG. More...
 
void info (const char *string_format,...)
 Log a message with info level. More...
 
void info (const std::string &message)
 Log a message with info level. More...
 
bool is_info_enabled (void) const
 Return true if the Logger will log messages with level INFO. More...
 
LoggerStream info_stream (void)
 Return a LoggerStream with level INFO. More...
 
void warn (const char *string_format,...)
 Log a message with warn level. More...
 
void warn (const std::string &message)
 Log a message with warn level. More...
 
bool is_warn_enabled (void) const
 Return true if the Logger will log messages with level WARN. More...
 
LoggerStream warn_stream (void)
 Return a LoggerStream with level WARN. More...
 
void error (const char *string_format,...)
 Log a message with error level. More...
 
void error (const std::string &message)
 Log a message with error level. More...
 
bool is_error_enabled (void) const
 Return true if the Logger will log messages with level ERROR. More...
 
LoggerStream error_stream (void)
 Return a LoggerStream with level ERROR. More...
 
void fatal (const char *string_format,...)
 Log a message with fatal level. More...
 
void fatal (const std::string &message)
 Log a message with fatal level. More...
 
bool is_fatal_enabled (void) const
 Return true if the Logger will log messages with level FATAL. More...
 
LoggerStream fatal_stream (void)
 Return a LoggerStream with level FATAL. More...
 
LoggerStream get_stream (Level::Value level, bool filter=true)
 Return a LoggerStream with given Level. More...
 
- Public Member Functions inherited from log4tango::AppenderAttachable
 AppenderAttachable ()
 Constructor. More...
 
virtual ~AppenderAttachable ()
 Destructor. More...
 
void add_appender (Appender *appender)
 Adds an Appender. More...
 
AppenderList get_all_appenders (void)
 Get all previously added appenders as a vector. More...
 
Appenderget_appender (const std::string &name)
 Get an appender by name. More...
 
bool is_attached (Appender *appender)
 Returns true if the specified appender is in list of attached appanders, false otherwise. More...
 
void remove_all_appenders ()
 Removes all appenders for this Logger. More...
 
void remove_appender (Appender *appender)
 Remove the appender passed as parameter from the list of appenders. More...
 
void remove_appender (const std::string &name)
 Remove the appender with the name passed as parameter from the list of appenders. More...
 

Protected Member Functions

void call_appenders (const LoggingEvent &event)
 Call the appenders. More...
 
- Protected Member Functions inherited from log4tango::AppenderAttachable
 AppenderAttachable (const AppenderAttachable &other)
 
AppenderAttachableoperator= (const AppenderAttachable &other)
 

Additional Inherited Members

- Protected Attributes inherited from log4tango::AppenderAttachable
AppenderMap _appenders
 Appenders repository. More...
 
threading::Mutex _appendersMutex
 A mutex to protect the repository against race conditions. More...
 

Constructor & Destructor Documentation

◆ Logger()

log4tango::Logger::Logger ( const std::string &  name,
Level::Value  level = Level::OFF 
)

Constructor.

Parameters
namethe fully qualified name of this Logger
levelthe level for this Logger. Defaults to Level::OFF

◆ ~Logger()

log4tango::Logger::~Logger ( )
virtual

Destructor.

Member Function Documentation

◆ call_appenders()

void log4tango::Logger::call_appenders ( const LoggingEvent event)
protected

Call the appenders.

Parameters
eventthe LogginEvent to log.

◆ debug() [1/2]

void log4tango::Logger::debug ( const char *  string_format,
  ... 
)

Log a message with debug level.

Parameters
string_formatFormat specifier for the log.
...The arguments for string_format

◆ debug() [2/2]

void log4tango::Logger::debug ( const std::string &  message)
inline

Log a message with debug level.

Parameters
messagestring to write in the log file

◆ debug_stream()

LoggerStream log4tango::Logger::debug_stream ( void  )
inline

Return a LoggerStream with level DEBUG.

Returns
The LoggerStream.

◆ error() [1/2]

void log4tango::Logger::error ( const char *  string_format,
  ... 
)

Log a message with error level.

Parameters
string_formatFormat specifier for the log.
...The arguments for string_format

◆ error() [2/2]

void log4tango::Logger::error ( const std::string &  message)
inline

Log a message with error level.

Parameters
messagestring to write in the log file

◆ error_stream()

LoggerStream log4tango::Logger::error_stream ( void  )
inline

Return a LoggerStream with level ERROR.

Returns
The LoggerStream.

◆ fatal() [1/2]

void log4tango::Logger::fatal ( const char *  string_format,
  ... 
)

Log a message with fatal level.

Parameters
string_formatFormat specifier for the log.
...The arguments for string_format

◆ fatal() [2/2]

void log4tango::Logger::fatal ( const std::string &  message)
inline

Log a message with fatal level.

Parameters
messagestring to write in the log file

◆ fatal_stream()

LoggerStream log4tango::Logger::fatal_stream ( void  )
inline

Return a LoggerStream with level FATAL.

Returns
The LoggerStream.

◆ get_level()

Level::Value log4tango::Logger::get_level ( ) const
inline

Returns the assigned Level, if any, for this Logger.

Returns
Level - the assigned Level, can be Level::NOTSET

◆ get_name()

const std::string& log4tango::Logger::get_name ( ) const
inline

Return the logger name.

Returns
The logger name.

◆ get_stream()

LoggerStream log4tango::Logger::get_stream ( Level::Value  level,
bool  filter = true 
)
inline

Return a LoggerStream with given Level.

Parameters
levelThe Level of the LoggerStream.
filterThe filter flag
Returns
The requested LoggerStream.

◆ info() [1/2]

void log4tango::Logger::info ( const char *  string_format,
  ... 
)

Log a message with info level.

Parameters
string_formatFormat specifier for the log.
...The arguments for string_format

◆ info() [2/2]

void log4tango::Logger::info ( const std::string &  message)
inline

Log a message with info level.

Parameters
messagestring to write in the log file

◆ info_stream()

LoggerStream log4tango::Logger::info_stream ( void  )
inline

Return a LoggerStream with level INFO.

Returns
The LoggerStream.

◆ is_debug_enabled()

bool log4tango::Logger::is_debug_enabled ( void  ) const
inline

Return true if the Logger will log messages with level DEBUG.

Returns
Whether the Logger will log.

◆ is_error_enabled()

bool log4tango::Logger::is_error_enabled ( void  ) const
inline

Return true if the Logger will log messages with level ERROR.

Returns
Whether the Logger will log.

◆ is_fatal_enabled()

bool log4tango::Logger::is_fatal_enabled ( void  ) const
inline

Return true if the Logger will log messages with level FATAL.

Returns
Whether the Logger will log.

◆ is_info_enabled()

bool log4tango::Logger::is_info_enabled ( void  ) const
inline

Return true if the Logger will log messages with level INFO.

Returns
Whether the Logger will log.

◆ is_level_enabled()

bool log4tango::Logger::is_level_enabled ( Level::Value  level) const
inline

Returns true if the level of the Logger is equal to or higher than given level.

Parameters
levelThe level to compare with.
Returns
whether logging is enable for this level.

◆ is_warn_enabled()

bool log4tango::Logger::is_warn_enabled ( void  ) const
inline

Return true if the Logger will log messages with level WARN.

Returns
Whether the Logger will log.

◆ log() [1/2]

void log4tango::Logger::log ( Level::Value  level,
const char *  string_format,
  ... 
)

Log a message with the specified level.

Parameters
levelThe level of this log message.
string_formatFormat specifier for the log .
...The arguments for string_format

◆ log() [2/2]

void log4tango::Logger::log ( Level::Value  level,
const std::string &  message 
)
inline

Log a message with the specified level.

Parameters
levelThe level of this log message.
messagestring to write in the log file

◆ log_unconditionally() [1/2]

void log4tango::Logger::log_unconditionally ( Level::Value  level,
const char *  string_format,
  ... 
)

Log a message with the specified level without level checking.

Parameters
levelThe level of this log message.
string_formatFormat specifier for the log .
...The arguments for string_format

◆ log_unconditionally() [2/2]

void log4tango::Logger::log_unconditionally ( Level::Value  level,
const std::string &  message 
)

Log a message with the specified level without level checking.

Parameters
levelThe level of this log message.
messagestring to write in the log file

◆ set_level()

void log4tango::Logger::set_level ( Level::Value  level)

Set the level of this Logger (silently ignores invalid values)

Parameters
levelThe level to set.

◆ warn() [1/2]

void log4tango::Logger::warn ( const char *  string_format,
  ... 
)

Log a message with warn level.

Parameters
string_formatFormat specifier for the log.
...The arguments for string_format

◆ warn() [2/2]

void log4tango::Logger::warn ( const std::string &  message)
inline

Log a message with warn level.

Parameters
messagestring to write in the log file

◆ warn_stream()

LoggerStream log4tango::Logger::warn_stream ( void  )
inline

Return a LoggerStream with level WARN.

Returns
The LoggerStream.

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