Logging

group logging

Logging is a light, multi-level, compile-time-filterable, logging framework that is similar to glog in output format.

It defines two logging macros, one for conventional logging and the other for verbose logging. Compile time filtering is applied separately to each of the two.

Output format:

LMMDD HH:MM:SS.uuuuuu tid filename:##] Log message ...

Where:

L: Log level {Fatal, Critical, Error, Warning, Info}
MMDD: month, day
HH:MM:SS.uuuuuu: time (24-hour format) with micro-seconds
tid: thread ID
filename:## the basename of the source file and line number of the FL_LOG
message

FL_LOG use examples:
\code
  FL_LOG(INFO) << "foo bar n=" << 42;
Output example: I0206 10:42:21.047293 87072 Logging.h:15 foo bar n=42 Note that FL_LOG(level) only prints when level is <= from value set to Logging::setMaxLoggingLevel(level)

FL_VLOG use example:

FL_VLOG(1) << "foo bar n=" << 42;
Output example:
vlog(1)0206 10:42:21.005439 87072 Logging.h:23 foo bar n=42
Note that FL_VLOG(level) only prints when level is <= from value set to
VerboseLogging::setMaxLoggingLevel(level)

Gives output:

vlog(1) 0206 10:42:21.005439 87072 Logging.h:23 foo bar n=42

Note that VLOG(level) only prints when level is less than or equal to the value set to VerboseLogging

Defines

FL_LOG(level)

Write to log output for a given LogLevel.

FL_VLOG(level)

Write to verbose log output for a given verbose logging level.

FL_LOG_IF(level, exp)
FL_VLOG_IF(level, exp)

Enums

enum class LogLevel

Values:

enumerator DISABLED
enumerator FATAL
enumerator ERROR
enumerator WARNING
enumerator INFO

Functions

FL_API LogLevel logLevelValue (const std::string &level)

Gets the LogLevel for a given string.

Throws if invalid.

FL_API std::string logLevelName (LogLevel level)

Gets string representation of a given LogLevel.

Variables

constexpr LogLevel DEFAULT_MAX_FL_LOGGING_LEVEL = LogLevel::INFO

Used to globally limit FL_LOG(level).

constexpr int DEFAULT_MAX_VERBOSE_FL_LOGGING_LEVEL = 0

MAX_VERBOSE_FL_LOGGING_LEVEL values are based on the values used in FL_VLOG() and can be any value, but expected reasonable values are: 0..10 for print none and print all respectively.