Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::ConsoleLogger Class Reference

Interface for logging to stderr. More...

#include <>>

Inheritance diagram for fawkes::ConsoleLogger:

Public Member Functions

 ConsoleLogger (LogLevel log_level=LL_DEBUG)
 Constructor. More...
 
virtual ~ConsoleLogger ()
 Destructor. More...
 
virtual void log_debug (const char *component, const char *format,...)
 Log debug message. More...
 
virtual void log_info (const char *component, const char *format,...)
 Log informational message. More...
 
virtual void log_warn (const char *component, const char *format,...)
 Log warning message. More...
 
virtual void log_error (const char *component, const char *format,...)
 Log error message. More...
 
virtual void vlog_debug (const char *component, const char *format, va_list va)
 Log debug message. More...
 
virtual void vlog_info (const char *component, const char *format, va_list va)
 Log informational message. More...
 
virtual void vlog_warn (const char *component, const char *format, va_list va)
 Log warning message. More...
 
virtual void vlog_error (const char *component, const char *format, va_list va)
 Log error message. More...
 
virtual void log_debug (const char *component, Exception &e)
 Log debug exception. More...
 
virtual void log_info (const char *component, Exception &e)
 Log informational exception. More...
 
virtual void log_warn (const char *component, Exception &e)
 Log warning exception. More...
 
virtual void log_error (const char *component, Exception &e)
 Log error exception. More...
 
virtual void tlog_debug (struct timeval *t, const char *component, const char *format,...)
 Log debug message for specific time. More...
 
virtual void tlog_info (struct timeval *t, const char *component, const char *format,...)
 Log informational message for specific time. More...
 
virtual void tlog_warn (struct timeval *t, const char *component, const char *format,...)
 Log warning message for specific time. More...
 
virtual void tlog_error (struct timeval *t, const char *component, const char *format,...)
 Log error message for specific time. More...
 
virtual void tlog_debug (struct timeval *t, const char *component, Exception &e)
 Log debug exception for specific time. More...
 
virtual void tlog_info (struct timeval *t, const char *component, Exception &e)
 Log informational exception for specific time. More...
 
virtual void tlog_warn (struct timeval *t, const char *component, Exception &e)
 Log warning exception for specific time. More...
 
virtual void tlog_error (struct timeval *t, const char *component, Exception &e)
 Log error exception for specific time. More...
 
virtual void vtlog_debug (struct timeval *t, const char *component, const char *format, va_list va)
 Log debug message for specific time. More...
 
virtual void vtlog_info (struct timeval *t, const char *component, const char *format, va_list va)
 Log informational message for specific time. More...
 
virtual void vtlog_warn (struct timeval *t, const char *component, const char *format, va_list va)
 Log warning message for specific time. More...
 
virtual void vtlog_error (struct timeval *t, const char *component, const char *format, va_list va)
 Log error message for specific time. More...
 
- Public Member Functions inherited from fawkes::Logger
 Logger (LogLevel log_level=LL_DEBUG)
 Constructor. More...
 
virtual ~Logger ()
 Virtual empty destructor. More...
 
virtual void set_loglevel (LogLevel level)
 Sets the log level. More...
 
virtual LogLevel loglevel ()
 Get log level. More...
 
virtual void log (LogLevel level, const char *component, const char *format,...)
 Log message of given log level. More...
 
virtual void log (LogLevel level, const char *component, Exception &e)
 Log exception for given log level. More...
 
virtual void vlog (LogLevel level, const char *component, const char *format, va_list va)
 Log message for given log level. More...
 
virtual void tlog (LogLevel level, struct timeval *t, const char *component, const char *format,...)
 Log message of given log level and time. More...
 
virtual void tlog (LogLevel level, struct timeval *t, const char *component, Exception &e)
 Log exception for given log level. More...
 
virtual void vtlog (LogLevel level, struct timeval *t, const char *component, const char *format, va_list va)
 Log message for given log level and time. More...
 

Additional Inherited Members

- Public Types inherited from fawkes::Logger
enum  LogLevel {
  LL_DEBUG = 0, LL_INFO = 1, LL_WARN = 2, LL_ERROR = 4,
  LL_NONE = 8
}
 Log level. More...
 
- Protected Attributes inherited from fawkes::Logger
LogLevel log_level
 Minimum log level. More...
 

Detailed Description

Interface for logging to stderr.

The ConsoleLogger will pipe all output to stderr on the console. The output will be color coded due to the importance of the output.

Debug output will be drawn in grey font, informational output in console default color, warnings will be printed in brown/orange and errors in red.

Author
Tim Niemueller

Definition at line 35 of file console.h.

Constructor & Destructor Documentation

fawkes::ConsoleLogger::ConsoleLogger ( LogLevel  log_level = LL_DEBUG)

Constructor.

Parameters
log_levelminimum level to log

Definition at line 50 of file console.cpp.

fawkes::ConsoleLogger::~ConsoleLogger ( )
virtual

Destructor.

Definition at line 59 of file console.cpp.

Member Function Documentation

void fawkes::ConsoleLogger::log_debug ( const char *  component,
const char *  format,
  ... 
)
virtual

Log debug message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 135 of file console.cpp.

References vlog_debug().

void fawkes::ConsoleLogger::log_debug ( const char *  component,
Exception e 
)
virtual

Log debug exception.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 175 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_lightgray, fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::log_error ( const char *  component,
const char *  format,
  ... 
)
virtual

Log error message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 165 of file console.cpp.

References vlog_error().

void fawkes::ConsoleLogger::log_error ( const char *  component,
Exception e 
)
virtual

Log error exception.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 232 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_normal, fawkes::c_red, fawkes::Exception::end(), fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::log_info ( const char *  component,
const char *  format,
  ... 
)
virtual

Log informational message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 145 of file console.cpp.

References vlog_info().

void fawkes::ConsoleLogger::log_info ( const char *  component,
Exception e 
)
virtual

Log informational exception.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 194 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_INFO, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::log_warn ( const char *  component,
const char *  format,
  ... 
)
virtual

Log warning message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 155 of file console.cpp.

References vlog_warn().

void fawkes::ConsoleLogger::log_warn ( const char *  component,
Exception e 
)
virtual

Log warning exception.

Parameters
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 213 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_brown, fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::tlog_debug ( struct timeval *  t,
const char *  component,
const char *  format,
  ... 
)
virtual

Log debug message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 251 of file console.cpp.

References vtlog_debug().

void fawkes::ConsoleLogger::tlog_debug ( struct timeval *  t,
const char *  component,
Exception e 
)
virtual

Log debug exception for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 291 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_lightgray, fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::tlog_error ( struct timeval *  t,
const char *  component,
const char *  format,
  ... 
)
virtual

Log error message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 281 of file console.cpp.

References vtlog_error().

void fawkes::ConsoleLogger::tlog_error ( struct timeval *  t,
const char *  component,
Exception e 
)
virtual

Log error exception for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 342 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_normal, fawkes::c_red, fawkes::Exception::end(), fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::tlog_info ( struct timeval *  t,
const char *  component,
const char *  format,
  ... 
)
virtual

Log informational message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 261 of file console.cpp.

References vtlog_info().

void fawkes::ConsoleLogger::tlog_info ( struct timeval *  t,
const char *  component,
Exception e 
)
virtual

Log informational exception for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 308 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_INFO, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::tlog_warn ( struct timeval *  t,
const char *  component,
const char *  format,
  ... 
)
virtual

Log warning message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 271 of file console.cpp.

References vtlog_warn().

void fawkes::ConsoleLogger::tlog_warn ( struct timeval *  t,
const char *  component,
Exception e 
)
virtual

Log warning exception for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
eexception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 325 of file console.cpp.

References fawkes::Exception::begin(), fawkes::c_brown, fawkes::c_normal, fawkes::Exception::end(), fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

void fawkes::ConsoleLogger::vlog_debug ( const char *  component,
const char *  format,
va_list  va 
)
virtual

Log debug message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 67 of file console.cpp.

References fawkes::c_lightgray, fawkes::c_normal, fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by log_debug().

void fawkes::ConsoleLogger::vlog_error ( const char *  component,
const char *  format,
va_list  va 
)
virtual

Log error message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 118 of file console.cpp.

References fawkes::c_normal, fawkes::c_red, fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by log_error().

void fawkes::ConsoleLogger::vlog_info ( const char *  component,
const char *  format,
va_list  va 
)
virtual

Log informational message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 84 of file console.cpp.

References fawkes::Logger::LL_INFO, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by log_info().

void fawkes::ConsoleLogger::vlog_warn ( const char *  component,
const char *  format,
va_list  va 
)
virtual

Log warning message.

Parameters
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 101 of file console.cpp.

References fawkes::c_brown, fawkes::c_normal, fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by log_warn().

void fawkes::ConsoleLogger::vtlog_debug ( struct timeval *  t,
const char *  component,
const char *  format,
va_list  va 
)
virtual

Log debug message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 361 of file console.cpp.

References fawkes::c_lightgray, fawkes::c_normal, fawkes::Logger::LL_DEBUG, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by tlog_debug().

void fawkes::ConsoleLogger::vtlog_error ( struct timeval *  t,
const char *  component,
const char *  format,
va_list  va 
)
virtual

Log error message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 406 of file console.cpp.

References fawkes::c_normal, fawkes::c_red, fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by tlog_error().

void fawkes::ConsoleLogger::vtlog_info ( struct timeval *  t,
const char *  component,
const char *  format,
va_list  va 
)
virtual

Log informational message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 376 of file console.cpp.

References fawkes::Logger::LL_INFO, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by tlog_info().

void fawkes::ConsoleLogger::vtlog_warn ( struct timeval *  t,
const char *  component,
const char *  format,
va_list  va 
)
virtual

Log warning message for specific time.

Parameters
ttime for this message to log
componentcomponent, used to distuinguish logged messages
formatformat of the message, see man page of sprintf for available tokens.
vavariable argument list

Implements fawkes::Logger.

Definition at line 391 of file console.cpp.

References fawkes::c_brown, fawkes::c_normal, fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, and fawkes::Mutex::unlock().

Referenced by tlog_warn().


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