Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members

CLog Class Reference

Logging facility. More...

#include <CLog.h>

Collaboration diagram for CLog:

Collaboration graph
[legend]
List of all members.

accessors

void print (const char *file, int line, const char *format,...) const
 Print a log message.
int getFilter () const
 Get the minimum priority level.
CLoggetInstance ()
 Get the singleton instance of the log.

Public Types

enum  ELevel {
  kFATAL, kERROR, kWARNING, kNOTE,
  kINFO, kDEBUG, kDEBUG1, kDEBUG2
}
 Log levels. More...

Public Member Functions

manipulators
void insert (ILogOutputter *adopted, bool alwaysAtHead=false)
 Add an outputter to the head of the list.
void remove (ILogOutputter *orphaned)
 Remove an outputter from the list.
void pop_front (bool alwaysAtHead=false)
 Remove the outputter from the head of the list.
bool setFilter (const char *name)
 Set the minimum priority filter.
void setFilter (int)

Detailed Description

Logging facility.

The logging class; all console output should go through this class. It supports multithread safe operation, several message priority levels, filtering by priority, and output redirection. The macros LOG() and LOGC() provide convenient access.

Definition at line 34 of file CLog.h.


Member Enumeration Documentation

enum CLog::ELevel
 

Log levels.

The logging priority levels in order of highest to lowest priority.

Enumeration values:
kFATAL  For fatal errors.
kERROR  For serious errors.
kWARNING  For minor errors and warnings.
kNOTE  For messages about notable events.
kINFO  For informational messages.
kDEBUG  For important debugging messages.
kDEBUG1  For more detailed debugging messages.
kDEBUG2  For even more detailed debugging messages.

Definition at line 40 of file CLog.h.


Member Function Documentation

void CLog::insert ILogOutputter adopted,
bool  alwaysAtHead = false
 

Add an outputter to the head of the list.

Inserts an outputter to the head of the outputter list. When the logger writes a message, it goes to the outputter at the head of the outputter list. If that outputter's write() method returns true then it also goes to the next outputter, as so on until an outputter returns false or there are no more outputters. Outputters still in the outputter list when the log is destroyed will be deleted. If alwaysAtHead is true then the outputter is always called before all outputters with alwaysAtHead false and the return value of the outputter is ignored.

By default, the logger has one outputter installed which writes to the console.

Definition at line 184 of file CLog.cpp.

References ILogOutputter::getNewline(), and ILogOutputter::open().

void CLog::pop_front bool  alwaysAtHead = false  ) 
 

Remove the outputter from the head of the list.

Removes and deletes the outputter at the head of the outputter list. This does nothing if the outputter list is empty. Only removes outputters that were inserted with the matching alwaysAtHead.

Definition at line 221 of file CLog.cpp.

void CLog::print const char *  file,
int  line,
const char *  format,
  ...
const
 

Print a log message.

Print a log message using the printf-like format and arguments preceded by the filename and line number. If file is NULL then neither the file nor the line are printed.

Definition at line 105 of file CLog.cpp.

References getFilter().

void CLog::remove ILogOutputter orphaned  ) 
 

Remove an outputter from the list.

Removes the first occurrence of the given outputter from the outputter list. It does nothing if the outputter is not in the list. The outputter is not deleted.

Definition at line 213 of file CLog.cpp.

bool CLog::setFilter const char *  name  ) 
 

Set the minimum priority filter.

Set the filter. Messages below this priority are discarded. The default priority is 4 (INFO) (unless built without NDEBUG in which case it's 5 (DEBUG)). setFilter(const char*) returns true if the priority name was recognized; if name is NULL then it simply returns true.

Definition at line 232 of file CLog.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Nov 6 00:21:24 2009 for synergy-plus by  doxygen 1.3.9.1