OmniSketch  0.1
Oh my sketch!
logger.h File Reference

Log to the standard error. More...

#include <string>
Include dependency graph for logger.h:
This graph shows which files directly or indirectly include this file:

Macros

#define LOG(level, msg)   Log((level), (msg), strrchr("/" __FILE__, '/') + 1, __LINE__)
 

Enumerations

enum  LogLevel {
  VERBOSE, INFO, WARNING, ERROR,
  FATAL, UNKNOWN
}
 

Functions

void Log (LogLevel level, const std::string &msg, const std::string &file, int lineno)
 Workhorse of logging. More...
 

Detailed Description

Log to the standard error.

Author
FerricIon (you@d.nosp@m.omai.nosp@m.n.com)

Macro Definition Documentation

◆ LOG

#define LOG (   level,
  msg 
)    Log((level), (msg), strrchr("/" __FILE__, '/') + 1, __LINE__)

Enumeration Type Documentation

◆ LogLevel

enum LogLevel
Enumerator
VERBOSE 

for verbosity

INFO 

informing messages

WARNING 

potential error

ERROR 

error

FATAL 

fatal error

UNKNOWN 

unknown circumstances

Function Documentation

◆ Log()

void Log ( LogLevel  level,
const std::string &  msg,
const std::string &  file,
int  lineno 
)

Workhorse of logging.

The log shows not only its content and level, but the file and the line where it was generated as well.

Parameters
levellevel of the log, namely
  • VERBOSE
  • INFO
  • WARNING
  • ERROR
  • FATAL
  • UNKNOWN

These names are quite self-explanatory.

Parameters
msgcontent of the message
filethe file from which the log is generated
linenothe line at which the log is generated
Warning
Never call this function directly. Rather, use the LOG macro as follows.
std::string msg = "This is an INFO";
LOG(INFO, msg);
INFO
@ INFO
informing messages
Definition: logger.h:15
LOG
#define LOG(level, msg)
Definition: logger.h:22