ngscopeclient v0.2.2
Loading...
Searching...
No Matches
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::TRACE = 7
}
 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.
 
const char const char std::string LogHexDump (const unsigned char *data, size_t len)
 Convert a sequence of bytes to its textual representation ("hex dump").
 

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.
 
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.

Function Documentation

◆ LogHexDump()

const char const char std::string LogHexDump ( const unsigned char *  data,
size_t  len 
)

Convert a sequence of bytes to its textual representation ("hex dump").

Parameters
dataPointer to the byte sequence to print.
lenNumber of bytes to print.
Returns
string representation of the data buffer.

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.