Fawkes API Fawkes Development Version

fawkes::CacheLogger Class Reference

Logging Cache. More...

#include <>>

Inheritance diagram for fawkes::CacheLogger:

List of all members.

Classes

struct  CacheEntry
 Cache entry struct. More...

Public Member Functions

 CacheLogger (unsigned int num_entries=20, LogLevel log_level=LL_DEBUG)
 Constructor.
virtual ~CacheLogger ()
 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.
std::list< CacheEntry > & get_messages ()
 Get messages.
void clear ()
 Clear messages.
unsigned int size () const
 Get maximum number of log entries in cache.
void set_size (unsigned int new_size)
 Set maximum number of log entries in cache.
void lock ()
 Lock cache logger, no new messages can be added.
void unlock ()
 Unlock cache logger.

Detailed Description

Logging Cache.

The CacheLogger will cache the log messages. By default these are 20 messages.

Author:
Tim Niemueller

Definition at line 40 of file cache.h.


Constructor & Destructor Documentation

fawkes::CacheLogger::CacheLogger ( unsigned int  num_entries = 20,
LogLevel  log_level = LL_DEBUG 
)

Constructor.

Parameters:
num_entriesnumber of entries in the cache, if the cache is full and a new log message arrives the oldest message is erased.
log_levelminimum level to log

Definition at line 51 of file cache.cpp.

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

Destructor.

Definition at line 62 of file cache.cpp.


Member Function Documentation

void fawkes::CacheLogger::clear ( void  )

Clear messages.

Definition at line 75 of file cache.cpp.

References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().

Referenced by XmlRpcThread::init(), and WebviewThread::init().

std::list< CacheLogger::CacheEntry > & fawkes::CacheLogger::get_messages ( )

Get messages.

Returns:
reference to message list

Definition at line 69 of file cache.cpp.

void fawkes::CacheLogger::lock ( )

Lock cache logger, no new messages can be added.

Use with care, can cause critical delays in the whole software stack!

Definition at line 113 of file cache.cpp.

References fawkes::Mutex::lock().

Referenced by set_size().

void fawkes::CacheLogger::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 260 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 224 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 251 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 278 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 233 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 266 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 272 of file cache.cpp.

References fawkes::Logger::LL_WARN.

void fawkes::CacheLogger::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 242 of file cache.cpp.

References fawkes::Logger::LL_WARN.

void fawkes::CacheLogger::set_size ( unsigned int  new_size)

Set maximum number of log entries in cache.

Parameters:
new_sizenew size

Definition at line 98 of file cache.cpp.

References lock().

unsigned int fawkes::CacheLogger::size ( ) const

Get maximum number of log entries in cache.

Returns:
maximum number of cache entries

Definition at line 88 of file cache.cpp.

void fawkes::CacheLogger::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 353 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 389 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 380 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 407 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 395 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 362 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 371 of file cache.cpp.

References fawkes::Logger::LL_WARN.

void fawkes::CacheLogger::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 401 of file cache.cpp.

References fawkes::Logger::LL_WARN.

void fawkes::CacheLogger::unlock ( )

Unlock cache logger.

Definition at line 120 of file cache.cpp.

References fawkes::Mutex::unlock().

void fawkes::CacheLogger::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 200 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 218 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 206 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 212 of file cache.cpp.

References fawkes::Logger::LL_WARN.

void fawkes::CacheLogger::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 413 of file cache.cpp.

References fawkes::Logger::LL_DEBUG.

void fawkes::CacheLogger::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 431 of file cache.cpp.

References fawkes::Logger::LL_ERROR.

void fawkes::CacheLogger::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 419 of file cache.cpp.

References fawkes::Logger::LL_INFO.

void fawkes::CacheLogger::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 425 of file cache.cpp.

References fawkes::Logger::LL_WARN.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends