nidas  v1.2-1520
Classes | Namespaces | Macros | Functions
Logger.h File Reference

Header file for the nidas::util logging facility. More...

#include "ThreadSupport.h"
#include <cstdarg>
#include <syslog.h>
#include <iostream>
#include <string>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <map>

Go to the source code of this file.

Classes

class  nidas::util::LogContext
 The LogContext is created at a point in the application code and filled in with details about that log point, such as the file and line number, and the function name of the containing function, and the log level of that log point, such as LOGGER_DEBUG or LOGGER_ERROR. More...
 
class  nidas::util::LogConfig
 A configuration to enable or disable a matching set of log points. More...
 
class  nidas::util::LogScheme
 A LogScheme is a vector of LogConfig's and the vector of fields to show in log messages. More...
 
class  nidas::util::LogMessage
 A class for formatting and streaming a log message. More...
 
class  nidas::util::Logger
 Simple logging class, based on UNIX syslog interface. More...
 

Namespaces

 nidas
 Root namespace for the NCAR In-Situ Data Acquisition Software.
 
 nidas::util
 General utility classes. nidas::util contains classes of general utility, like Socket, Thread, etc. The classes use only the standard Unix system libraries and libstdc++, and have no dependency on other external packages such as an XML parser, or a logging package.
 

Macros

#define LOG_CONTEXT(LEVEL)   nidas::util::LEVEL, __FILE__, __PRETTY_FUNCTION__, __LINE__
 
#define LOG_STATIC_CONTEXT(LEVEL)   nidas::util::LEVEL, __FILE__, "file_static_scope", __LINE__
 Expand to LogContext tuple outside function scope. More...
 
#define LOG_EMERG   LOG_CONTEXT(LOGGER_EMERG)
 
#define LOG_ALERT   LOG_CONTEXT(LOGGER_ALERT)
 
#define LOG_CRIT   LOG_CONTEXT(LOGGER_CRIT)
 
#define LOG_ERR   LOG_CONTEXT(LOGGER_ERR)
 
#define LOG_WARNING   LOG_CONTEXT(LOGGER_WARNING)
 
#define LOG_NOTICE   LOG_CONTEXT(LOGGER_NOTICE)
 
#define LOG_INFO   LOG_CONTEXT(LOGGER_INFO)
 
#define LOG_DEBUG   LOG_CONTEXT(LOGGER_DEBUG)
 
#define LOG_VERBOSE   LOG_CONTEXT(LOGGER_VERBOSE)
 
#define LOGGER_LOGPOINT(LEVEL, TAGS, MSG)
 This macro creates a static LogContext instance that is not in thread-local storage and therefore is not thread-safe. More...
 
#define ELOG(MSG)   LOGGER_LOGPOINT(LOGGER_EMERG,"",MSG)
 
#define ALOG(MSG)   LOGGER_LOGPOINT(LOGGER_ALERT,"",MSG)
 
#define CLOG(MSG)   LOGGER_LOGPOINT(LOGGER_CRITICAL,"",MSG)
 
#define PLOG(MSG)   LOGGER_LOGPOINT(LOGGER_ERR,"",MSG)
 
#define WLOG(MSG)   LOGGER_LOGPOINT(LOGGER_WARNING,"",MSG)
 
#define NLOG(MSG)   LOGGER_LOGPOINT(LOGGER_NOTICE,"",MSG)
 
#define ILOG(MSG)   LOGGER_LOGPOINT(LOGGER_INFO,"",MSG)
 
#define DLOG(MSG)   LOGGER_LOGPOINT(LOGGER_DEBUG,"",MSG)
 
#define VLOG(MSG)   LOGGER_LOGPOINT(LOGGER_VERBOSE,"",MSG)
 
#define ELOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_EMERG,TAGS,MSG)
 
#define ALOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_ALERT,TAGS,MSG)
 
#define CLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_CRITICAL,TAGS,MSG)
 
#define PLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_ERR,TAGS,MSG)
 
#define WLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_WARNING,TAGS,MSG)
 
#define NLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_NOTICE,TAGS,MSG)
 
#define ILOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_INFO,TAGS,MSG)
 
#define DLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_DEBUG,TAGS,MSG)
 
#define VLOGT(TAGS, MSG)   LOGGER_LOGPOINT(LOGGER_VERBOSE,TAGS,MSG)
 

Functions

int nidas::util::stringToLogLevel (const std::string &slevel)
 Convert the name of a log level to its integer value. More...
 
string nidas::util::logLevelToString (int)
 Convert an integral log level to a string name. More...
 
LogMessage & nidas::util::endlog (LogMessage &logmsg)
 LogMessage manipulator which logs the current message buffer, if any, and then clears the message. More...
 
LogMessage & nidas::util::operator<< (LogMessage &logmsg, LogMessage &(*op)(LogMessage &))
 Template to call LogMessage manipulators like endlog when streamed to a LogMessage. More...
 

Variables

const int nidas::util::LOGGER_EMERG = LOG_EMERG
 
const int nidas::util::LOGGER_EMERGENCY = LOG_EMERG
 
const int nidas::util::LOGGER_ALERT = LOG_ALERT
 
const int nidas::util::LOGGER_CRIT = LOG_CRIT
 
const int nidas::util::LOGGER_CRITICAL = LOG_CRIT
 
const int nidas::util::LOGGER_ERROR = LOG_ERR
 
const int nidas::util::LOGGER_ERR = LOG_ERR
 
const int nidas::util::LOGGER_PROBLEM = LOG_ERR
 
const int nidas::util::LOGGER_WARNING = LOG_WARNING
 
const int nidas::util::LOGGER_NOTICE = LOG_NOTICE
 
const int nidas::util::LOGGER_INFO = LOG_INFO
 
const int nidas::util::LOGGER_DEBUG = LOG_DEBUG
 
const int nidas::util::LOGGER_VERBOSE = LOG_DEBUG+1
 
const int nidas::util::LOGGER_NONE = LOG_EMERG-1
 

Detailed Description

Header file for the nidas::util logging facility.