Fawkes API  Fawkes Development Version
fawkes::FileLogger Class Reference

#include <>>

Inheritance diagram for fawkes::FileLogger:

Public Member Functions

 FileLogger (const char *filename, LogLevel min_level=LL_DEBUG)
 Constructor. More...
 
virtual ~FileLogger ()
 Destructor. More...
 
virtual void log_debug (const char *component, const char *format,...)
 
virtual void log_info (const char *component, const char *format,...)
 
virtual void log_warn (const char *component, const char *format,...)
 
virtual void log_error (const char *component, const char *format,...)
 
virtual void vlog_debug (const char *component, const char *format, va_list va)
 
virtual void vlog_info (const char *component, const char *format, va_list va)
 
virtual void vlog_warn (const char *component, const char *format, va_list va)
 
virtual void vlog_error (const char *component, const char *format, va_list va)
 
virtual void log_debug (const char *component, Exception &e)
 
virtual void log_info (const char *component, Exception &e)
 
virtual void log_warn (const char *component, Exception &e)
 
virtual void log_error (const char *component, Exception &e)
 
virtual void tlog_debug (struct timeval *t, const char *component, const char *format,...)
 
virtual void tlog_info (struct timeval *t, const char *component, const char *format,...)
 
virtual void tlog_warn (struct timeval *t, const char *component, const char *format,...)
 
virtual void tlog_error (struct timeval *t, const char *component, const char *format,...)
 
virtual void tlog_debug (struct timeval *t, const char *component, Exception &e)
 
virtual void tlog_info (struct timeval *t, const char *component, Exception &e)
 
virtual void tlog_warn (struct timeval *t, const char *component, Exception &e)
 
virtual void tlog_error (struct timeval *t, const char *component, Exception &e)
 
virtual void vtlog_debug (struct timeval *t, const char *component, const char *format, va_list va)
 
virtual void vtlog_info (struct timeval *t, const char *component, const char *format, va_list va)
 
virtual void vtlog_warn (struct timeval *t, const char *component, const char *format, va_list va)
 
virtual void vtlog_error (struct timeval *t, const char *component, const char *format, va_list va)
 
- 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 a specified file. The FileLogger will pipe all output into the given file. The output will be prepended by a single character which determines the type of output (E for error, W for warning, etc.).

Definition at line 44 of file file.h.

Constructor & Destructor Documentation

◆ FileLogger()

fawkes::FileLogger::FileLogger ( const char *  filename_pattern,
LogLevel  log_level = LL_DEBUG 
)

Constructor.

The filename is generated from the filename pattern by replacing '$time' with the current time.

Parameters
filename_patternthe name pattern of the log-file
log_levelminimum log level

Definition at line 62 of file file.cpp.

◆ ~FileLogger()

fawkes::FileLogger::~FileLogger ( )
virtual

Destructor.

Definition at line 127 of file file.cpp.

References vlog_debug().

Member Function Documentation

◆ log_debug() [1/2]

void fawkes::FileLogger::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 file.cpp.

References vlog_info().

◆ log_debug() [2/2]

void fawkes::FileLogger::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 171 of file file.cpp.

◆ log_error() [1/2]

void fawkes::FileLogger::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 162 of file file.cpp.

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

◆ log_error() [2/2]

void fawkes::FileLogger::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 246 of file file.cpp.

◆ log_info() [1/2]

void fawkes::FileLogger::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 144 of file file.cpp.

References vlog_warn().

◆ log_info() [2/2]

void fawkes::FileLogger::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 196 of file file.cpp.

◆ log_warn() [1/2]

void fawkes::FileLogger::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 153 of file file.cpp.

References vlog_error().

◆ log_warn() [2/2]

void fawkes::FileLogger::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 221 of file file.cpp.

◆ tlog_debug() [1/2]

void fawkes::FileLogger::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 363 of file file.cpp.

References vtlog_info().

◆ tlog_debug() [2/2]

void fawkes::FileLogger::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 399 of file file.cpp.

◆ tlog_error() [1/2]

void fawkes::FileLogger::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 390 of file file.cpp.

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

◆ tlog_error() [2/2]

void fawkes::FileLogger::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 468 of file file.cpp.

◆ tlog_info() [1/2]

void fawkes::FileLogger::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 372 of file file.cpp.

References vtlog_warn().

◆ tlog_info() [2/2]

void fawkes::FileLogger::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 422 of file file.cpp.

◆ tlog_warn() [1/2]

void fawkes::FileLogger::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 381 of file file.cpp.

References vtlog_error().

◆ tlog_warn() [2/2]

void fawkes::FileLogger::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 445 of file file.cpp.

◆ vlog_debug()

void fawkes::FileLogger::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 271 of file file.cpp.

Referenced by ~FileLogger().

◆ vlog_error()

void fawkes::FileLogger::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 340 of file file.cpp.

Referenced by log_warn().

◆ vlog_info()

void fawkes::FileLogger::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 294 of file file.cpp.

Referenced by log_debug().

◆ vlog_warn()

void fawkes::FileLogger::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 317 of file file.cpp.

Referenced by log_info().

◆ vtlog_debug()

void fawkes::FileLogger::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 491 of file file.cpp.

◆ vtlog_error()

void fawkes::FileLogger::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 554 of file file.cpp.

Referenced by tlog_warn().

◆ vtlog_info()

void fawkes::FileLogger::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 512 of file file.cpp.

Referenced by tlog_debug().

◆ vtlog_warn()

void fawkes::FileLogger::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 533 of file file.cpp.

Referenced by tlog_info().


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