nidas v1.2.3
Classes | Namespaces | Macros | Typedefs | Functions | Variables
Logger.cc File Reference
#include "Logger.h"
#include "ThreadSupport.h"
#include "Thread.h"
#include "UTime.h"
#include <string>
#include <cerrno>
#include <cstring>
#include <cstdarg>
#include <vector>
#include <map>
#include <algorithm>
#include <stdexcept>
#include <cctype>
#include <cstdlib>
#include <execinfo.h>

Classes

class  nidas::util::LoggerPrivate
 

Namespaces

namespace  nidas
 Root namespace for the NCAR In-Situ Data Acquisition Software.
 
namespace  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 DEBUG_LOGGER   0
 

Typedefs

typedef vector< LogContext * > log_points_v
 
typedef map< string, LogSchemelog_schemes_t
 

Functions

static LogScheme get_scheme (const std::string &name)
 Get a scheme with the name, or return a default.
 
static LogSchemelookup_scheme (const std::string &name)
 This must be called while the mutex is locked, since it accesses the shared LogScheme map, and it returns a pointer which might change once the lock is released.
 
static void stream_backtrace (std::ostream &out)
 
static string fillError (string fmt)
 
bool parse_log_level (int &level_out, const std::string &text)
 
int nidas::util::stringToLogLevel (const std::string &slevel)
 Convert the name of a log level to its integer value.
 
string nidas::util::logLevelToString (int)
 Convert an integral log level to a string name.
 

Variables

static log_points_v log_points
 Vector of pointers to all the LogContext instances initialized so far.
 
static log_schemes_t log_schemes
 Map of all the known LogScheme instances.
 
static LogScheme current_scheme = get_scheme("")
 
static LogScheme::LogField default_fields []
 
static LogContext show_point (LOG_STATIC_CONTEXT(LOGGER_INFO), "show_log_points")
 

Macro Definition Documentation

◆ DEBUG_LOGGER

#define DEBUG_LOGGER   0

Typedef Documentation

◆ log_points_v

typedef vector<LogContext*> log_points_v

◆ log_schemes_t

typedef map<string,LogScheme> log_schemes_t

Function Documentation

◆ fillError()

static string fillError ( string fmt)
static

◆ get_scheme()

static LogScheme get_scheme ( const std::string & name)
static

Get a scheme with the name, or return a default.

Must be called with the mutex locked.

References nidas::util::LogConfig::level, log_schemes, nidas::util::LOGGER_WARNING, and lookup_scheme().

Referenced by nidas::util::Logger::clearSchemes(), nidas::util::Logger::getScheme(), and nidas::util::Logger::setScheme().

◆ lookup_scheme()

static LogScheme * lookup_scheme ( const std::string & name)
static

This must be called while the mutex is locked, since it accesses the shared LogScheme map, and it returns a pointer which might change once the lock is released.

References log_schemes.

Referenced by get_scheme(), and nidas::util::Logger::knownScheme().

◆ parse_log_level()

bool parse_log_level ( int & level_out,
const std::string & text )

◆ stream_backtrace()

static void stream_backtrace ( std::ostream & out)
static

Variable Documentation

◆ current_scheme

LogScheme current_scheme = get_scheme("")
static

◆ default_fields

LogScheme::LogField default_fields[]
static
Initial value:
= {
}
@ LevelField
Definition Logger.h:689
@ TimeField
Definition Logger.h:691
@ MessageField
Definition Logger.h:690

◆ log_points

log_points_v log_points
static

◆ log_schemes

log_schemes_t log_schemes
static

◆ show_point

LogContext show_point(LOG_STATIC_CONTEXT(LOGGER_INFO), "show_log_points") ( LOG_STATIC_CONTEXT(LOGGER_INFO) ,
"show_log_points"  )
static