Public Member Functions

fawkes::FileLogger Class Reference

Interface for logging to a specified file. More...

#include <logging/file.h>

Inheritance diagram for fawkes::FileLogger:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 FileLogger (const char *filename, LogLevel min_level=LL_DEBUG)
 Constructor.
virtual ~FileLogger ()
 Destructor.
virtual void log_debug (const char *component, const char *format,...)
 Log debug message.
virtual void log_info (const char *component, const char *format,...)
 Log informational message.
virtual void log_warn (const char *component, const char *format,...)
 Log warning message.
virtual void log_error (const char *component, const char *format,...)
 Log error message.
virtual void vlog_debug (const char *component, const char *format, va_list va)
 Log debug message.
virtual void vlog_info (const char *component, const char *format, va_list va)
 Log informational message.
virtual void vlog_warn (const char *component, const char *format, va_list va)
 Log warning message.
virtual void vlog_error (const char *component, const char *format, va_list va)
 Log error message.
virtual void log_debug (const char *component, Exception &e)
 Log debug exception.
virtual void log_info (const char *component, Exception &e)
 Log informational exception.
virtual void log_warn (const char *component, Exception &e)
 Log warning exception.
virtual void log_error (const char *component, Exception &e)
 Log error exception.
virtual void tlog_debug (struct timeval *t, const char *component, const char *format,...)
 Log debug message for specific time.
virtual void tlog_info (struct timeval *t, const char *component, const char *format,...)
 Log informational message for specific time.
virtual void tlog_warn (struct timeval *t, const char *component, const char *format,...)
 Log warning message for specific time.
virtual void tlog_error (struct timeval *t, const char *component, const char *format,...)
 Log error message for specific time.
virtual void tlog_debug (struct timeval *t, const char *component, Exception &e)
 Log debug exception for specific time.
virtual void tlog_info (struct timeval *t, const char *component, Exception &e)
 Log informational exception for specific time.
virtual void tlog_warn (struct timeval *t, const char *component, Exception &e)
 Log warning exception for specific time.
virtual void tlog_error (struct timeval *t, const char *component, Exception &e)
 Log error exception for specific time.
virtual void vtlog_debug (struct timeval *t, const char *component, const char *format, va_list va)
 Log debug message for specific time.
virtual void vtlog_info (struct timeval *t, const char *component, const char *format, va_list va)
 Log informational message for specific time.
virtual void vtlog_warn (struct timeval *t, const char *component, const char *format, va_list va)
 Log warning message for specific time.
virtual void vtlog_error (struct timeval *t, const char *component, const char *format, va_list va)
 Log error message for specific time.

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


Constructor & Destructor Documentation

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

Constructor.

Parameters:
filename the name of the log-file
log_level minimum log level

Definition at line 49 of file file.cpp.

References fawkes::File::APPEND.

fawkes::FileLogger::~FileLogger (  )  [virtual]

Destructor.

Definition at line 65 of file file.cpp.


Member Function Documentation

void fawkes::FileLogger::log_debug ( const char *  component,
const char *  format,
  ... 
) [virtual]

Log debug message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 75 of file file.cpp.

References vlog_debug().

void fawkes::FileLogger::log_debug ( const char *  component,
Exception e 
) [virtual]

Log debug exception.

Parameters:
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 115 of file file.cpp.

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

void fawkes::FileLogger::log_error ( const char *  component,
const char *  format,
  ... 
) [virtual]

Log error message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 105 of file file.cpp.

References vlog_error().

void fawkes::FileLogger::log_error ( const char *  component,
Exception e 
) [virtual]

Log error exception.

Parameters:
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 175 of file file.cpp.

References fawkes::Exception::begin(), fawkes::Exception::end(), fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

void fawkes::FileLogger::log_info ( const char *  component,
const char *  format,
  ... 
) [virtual]

Log informational message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 85 of file file.cpp.

References vlog_info().

void fawkes::FileLogger::log_info ( const char *  component,
Exception e 
) [virtual]

Log informational exception.

Parameters:
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 135 of file file.cpp.

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

void fawkes::FileLogger::log_warn ( const char *  component,
Exception e 
) [virtual]

Log warning exception.

Parameters:
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 155 of file file.cpp.

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

void fawkes::FileLogger::log_warn ( const char *  component,
const char *  format,
  ... 
) [virtual]

Log warning message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 95 of file file.cpp.

References vlog_warn().

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

Log debug exception for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 307 of file file.cpp.

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

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

Log debug message for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 267 of file file.cpp.

References vtlog_debug().

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

Log error message for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 297 of file file.cpp.

References vtlog_error().

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

Log error exception for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 361 of file file.cpp.

References fawkes::Exception::begin(), fawkes::Exception::end(), fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

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

Log informational exception for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 325 of file file.cpp.

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

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

Log informational message for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 277 of file file.cpp.

References vtlog_info().

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

Log warning exception for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
e exception to log, exception messages will be logged

Implements fawkes::Logger.

Definition at line 343 of file file.cpp.

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

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

Log warning message for specific time.

Parameters:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.

Implements fawkes::Logger.

Definition at line 287 of file file.cpp.

References vtlog_warn().

void fawkes::FileLogger::vlog_debug ( const char *  component,
const char *  format,
va_list  va 
) [virtual]

Log debug message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 195 of file file.cpp.

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

Referenced by log_debug().

void fawkes::FileLogger::vlog_error ( const char *  component,
const char *  format,
va_list  va 
) [virtual]

Log error message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 249 of file file.cpp.

References fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

Referenced by log_error().

void fawkes::FileLogger::vlog_info ( const char *  component,
const char *  format,
va_list  va 
) [virtual]

Log informational message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 213 of file file.cpp.

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

Referenced by log_info().

void fawkes::FileLogger::vlog_warn ( const char *  component,
const char *  format,
va_list  va 
) [virtual]

Log warning message.

Parameters:
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 231 of file file.cpp.

References fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

Referenced by log_warn().

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:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 379 of file file.cpp.

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

Referenced by tlog_debug().

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:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 427 of file file.cpp.

References fawkes::Logger::LL_ERROR, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

Referenced by tlog_error().

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:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 395 of file file.cpp.

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

Referenced by tlog_info().

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:
t time for this message to log
component component, used to distuinguish logged messages
format format of the message, see man page of sprintf for available tokens.
va variable argument list

Implements fawkes::Logger.

Definition at line 411 of file file.cpp.

References fawkes::Logger::LL_WARN, fawkes::Mutex::lock(), fawkes::Logger::log_level, fawkes::File::stream(), and fawkes::Mutex::unlock().

Referenced by tlog_warn().


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