Class Logged

Class Documentation

class Logged

A class to provide general logging facilities.

Public Types

enum class level

Values:

enumerator ALL
enumerator TRACE
enumerator DEBUG_LVL
enumerator INFO
enumerator NOTICE
enumerator WARNING
enumerator ERROR
enumerator CRITICAL
enumerator ALERT
enumerator EMERGENCY
enumerator NONE

Public Static Functions

static void configure()

Static function that configures the logger.

static void log(const std::string &message, const level lvl = level::NOTICE)

Logs a message at the given log level, or default to level::NOTICE.

Parameters:
  • message – The message to be logged.

  • lvl – The level at which to log the message. Defaults to level::NOTICE if not provided.

static inline void trace(const std::string &message)

Logs a message at level::TRACE, intended for tracing code execution.

Parameters:

message – The message to be logged.

static inline void debug(const std::string &message)

Logs a message at level::DEBUG_LVL, intended for code debugging.

The enum constant is called DEBUG_LVL to avoid clashes when the macro constant DEBUG is defined as a result of compiling a Debug build.

Parameters:

message – The message to be logged.

static inline void info(const std::string &message)

Logs a message at level::INFO, intended for informational messages that would not normally be shown.

Parameters:

message – The message to be logged.

static inline void notice(const std::string &message)

Logs a message at level::NOTICE, intended for messages that would appear during normal execution.

Parameters:

message – The message to be logged.

static inline void warning(const std::string &message)

Logs a message at level::WARNING, intended for abnormal conditions that do not affect the continuing execution of the model.

Parameters:

message – The message to be logged.

static inline void error(const std::string &message)

Logs a message at level::ERROR, intended for when the model reaches an unrecoverable state.

Parameters:

message – The message to be logged.

static inline void critical(const std::string &message)

Logs a message at level::CRITICAL, intended for critical situations, including detection of problems with the hardware or software environment.

Parameters:

message – The message to be logged.

static inline void alert(const std::string &message)

Logs a message at level::ALERT. Probably not needed for a geophysical model.

Parameters:

message – The message to be logged.

static inline void emergency(const std::string &message)

Logs a message at level::EMERGENCY. Probably not needed for a geophysical model.

Parameters:

message – The message to be logged.

Public Static Attributes

static const std::map<std::string, level> levelNames = {{"all", level::ALL}, {"All", level::ALL}, {"ALL", level::ALL}, {"trace", level::TRACE}, {"TRACE", level::TRACE}, {"debug", level::DEBUG_LVL}, {"DEBUG", level::DEBUG_LVL}, {"info", level::INFO}, {"INFO", level::INFO}, {"warning", level::WARNING}, {"WARNING", level::WARNING}, {"error", level::ERROR}, {"ERROR", level::ERROR}, {"critical", level::CRITICAL}, {"CRITICAL", level::CRITICAL}, {"fatal", level::CRITICAL}, {"FATAL", level::CRITICAL}, {"alert", level::ALERT}, {"ALERT", level::ALERT}, {"emergency", level::EMERGENCY}, {"EMERGENCY", level::EMERGENCY}, {"none", level::NONE}, {"None", level::NONE}, {"NONE", level::NONE},}

Protected Functions

Logged() = default