ngscopeclient 0.1-dev+51fbda87c
Classes | Macros | Enumerations | Functions | Variables
log.h File Reference

Main logging framework header. More...

#include <memory>
#include <string>
#include <vector>
#include <set>
#include <mutex>
Include dependency graph for log.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  LogSink
 Base class for all log sinks. More...
 
class  STDLogSink
 A log sink writing to stdout/stderr depending on severity. More...
 
class  ColoredSTDLogSink
 A STDLogSink that colorizes "warning" or "error" keywords. More...
 
class  FILELogSink
 A log sink writing to a FILE* file handle. More...
 
class  LogIndenter
 RAII wrapper for log indentation. More...
 

Macros

#define ATTR_FORMAT(n, m)
 
#define ATTR_NORETURN
 
#define LogTrace(...)   LogDebugTrace(__func__, __VA_ARGS__)
 

Enumerations

enum class  Severity {
  Severity::FATAL = 1 , Severity::ERROR = 2 , Severity::WARNING = 3 , Severity::NOTICE = 4 ,
  Severity::VERBOSE = 5 , Severity::DEBUG = 6
}
 Severity of a logging message. More...
 

Functions

bool ParseLoggerArguments (int &i, int argc, char *argv[], Severity &console_verbosity)
 Helper function for parsing arguments that use common syntax.
 
 ATTR_FORMAT (1, 2) void LogVerbose(const char *format
 
 ATTR_FORMAT (2, 3) void Log(Severity severity
 Just print the message at given log level, don't do anything special for warnings or errors.
 

Variables

__thread unsigned int g_logIndentLevel
 The current indentation level.
 
std::mutex g_log_mutex
 Mutex for serializing access to global logging state.
 
std::vector< std::unique_ptr< LogSink > > g_log_sinks
 The set of log sink objects logtools knows about. More...
 
std::set< std::string > g_trace_filters
 Set of classes or class::function for high verbosity trace messages.
 
const char * format
 

Detailed Description

Main logging framework header.

Variable Documentation

◆ g_log_sinks

std::vector<std::unique_ptr<LogSink> > g_log_sinks
extern

The set of log sink objects logtools knows about.

When a log message is printed, it is sent to every sink in this list for filtering and display.