logstream.hpp File Reference


Detailed Description

Writing to a log stream made easy, typesafe, threadsafe and portable.

Inspired by Petru Marginean, "Logging in C++," Dr.Dobbs, October 2007.

Definition in file logstream.hpp.

#include <sstream>
#include <string>
#include <iostream>
#include <sys/time.h>

Include dependency graph for logstream.hpp:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Classes

class  Log
 template class Log is used by classes ConfigureLOG and ConfigureLOGstream. More...
class  ConfigureLOGstream
 class ConfigureLOGstream Configure and write to a log stream; type-safe, thread-safe and very portable. More...
class  ConfigureLOG
 class ConfigureLOG - inherits class Log with type ConfigureLOGstream More...

Defines

#define FILELOG_MAX_LEVEL   DEBUG7
 Define the maximum log level.
#define LOG(level)
 define the macro that is used to write to the log stream
#define pLOGstrm   ConfigureLOGstream::Stream()
#define LOGstrm   *(ConfigureLOGstream::Stream())
#define LOGlevel   ConfigureLOG::ReportingLevel()

Enumerations

enum  LogLevel {
  ERROR, WARNING, INFO, VERBOSE,
  DEBUG, DEBUG1, DEBUG2, DEBUG3,
  DEBUG4, DEBUG5, DEBUG6, DEBUG7
}
 levels that the user may give the log stream output in the output statement, e.g. More...


Define Documentation

#define FILELOG_MAX_LEVEL   DEBUG7
 

Define the maximum log level.

Definition at line 22 of file logstream.hpp.

#define LOG level   ) 
 

Value:

if(level > FILELOG_MAX_LEVEL) ;\
   else if(level > ConfigureLOG::ReportingLevel() || !ConfigureLOGstream::Stream()) ;\
   else ConfigureLOG().Put(level)
define the macro that is used to write to the log stream

Definition at line 296 of file logstream.hpp.

#define LOGlevel   ConfigureLOG::ReportingLevel()
 

Definition at line 304 of file logstream.hpp.

#define LOGstrm   *(ConfigureLOGstream::Stream())
 

Definition at line 303 of file logstream.hpp.

#define pLOGstrm   ConfigureLOGstream::Stream()
 

Definition at line 302 of file logstream.hpp.


Enumeration Type Documentation

enum LogLevel
 

levels that the user may give the log stream output in the output statement, e.g.

LOG(ERROR) << "This is an error message"; DEBUGn levels appear indented by 2*n spaces in the log stream. Default level is INFO.

Enumeration values:
ERROR 
WARNING 
INFO 
VERBOSE 
DEBUG 
DEBUG1 
DEBUG2 
DEBUG3 
DEBUG4 
DEBUG5 
DEBUG6 
DEBUG7 

Definition at line 18 of file logstream.hpp.

Referenced by Log::FromString(), LogStreamBuf::getLevel(), ConfigureLOG::Level(), and Log::ReportingLevel().


Generated on Wed Feb 8 03:31:13 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1