netxsimdg
Loading...
Searching...
No Matches
Nextsim::Logged Class Reference

A class to provide general logging facilities. More...

#include <Logged.hpp>

Collaboration diagram for Nextsim::Logged:
Collaboration graph

Public Types

enum class  level {
  ALL , TRACE , DEBUG_LVL , INFO ,
  NOTICE , WARNING , ERROR , CRITICAL ,
  ALERT , EMERGENCY , NONE
}
 
enum  { MINIMUM_LOG_LEVEL_KEY , FILE_NAME_PATTERN_KEY , CONSOLE_LOG_LEVEL_KEY }
 

Static Public Member 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.
 
static void trace (const std::string &message)
 Logs a message at level::TRACE, intended for tracing code execution.
 
static void debug (const std::string &message)
 Logs a message at level::DEBUG_LVL, intended for code debugging.
 
static void info (const std::string &message)
 Logs a message at level::INFO, intended for informational messages that would not normally be shown.
 
static void notice (const std::string &message)
 Logs a message at level::NOTICE, intended for messages that would appear during normal execution.
 
static 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.
 
static void error (const std::string &message)
 Logs a message at level::ERROR, intended for when the model reaches an unrecoverable state.
 
static 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.
 
static void alert (const std::string &message)
 Logs a message at level::ALERT. Probably not needed for a geophysical model.
 
static void emergency (const std::string &message)
 Logs a message at level::EMERGENCY. Probably not needed for a geophysical model.
 

Static Public Attributes

static const std::map< std::string, level > levelNames
 

Detailed Description

A class to provide general logging facilities.

Definition at line 16 of file Logged.hpp.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

Definition at line 34 of file Logged.hpp.

◆ level

enum class Nextsim::Logged::level
strong

Definition at line 20 of file Logged.hpp.

Member Function Documentation

◆ alert()

static void Nextsim::Logged::alert ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 106 of file Logged.hpp.

Here is the call graph for this function:

◆ configure()

void Nextsim::Logged::configure ( )
static

Static function that configures the logger.

Definition at line 55 of file Logged.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ critical()

static void Nextsim::Logged::critical ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 99 of file Logged.hpp.

Here is the call graph for this function:

◆ debug()

static void Nextsim::Logged::debug ( const std::string & message)
inlinestatic

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
messageThe message to be logged.

Definition at line 63 of file Logged.hpp.

Here is the call graph for this function:

◆ emergency()

static void Nextsim::Logged::emergency ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 113 of file Logged.hpp.

Here is the call graph for this function:

◆ error()

static void Nextsim::Logged::error ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 91 of file Logged.hpp.

Here is the call graph for this function:

◆ info()

static void Nextsim::Logged::info ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 70 of file Logged.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ log()

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

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

Parameters
messageThe message to be logged.
lvlThe level at which to log the message. Defaults to level::NOTICE if not provided.

Definition at line 71 of file Logged.cpp.

Here is the caller graph for this function:

◆ notice()

static void Nextsim::Logged::notice ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 77 of file Logged.hpp.

Here is the call graph for this function:

◆ trace()

static void Nextsim::Logged::trace ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 54 of file Logged.hpp.

Here is the call graph for this function:

◆ warning()

static void Nextsim::Logged::warning ( const std::string & message)
inlinestatic

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

Parameters
messageThe message to be logged.

Definition at line 84 of file Logged.hpp.

Here is the call graph for this function:

Member Data Documentation

◆ levelNames

const std::map< std::string, Logged::level > Nextsim::Logged::levelNames
static
Initial value:
= {
{ "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 },
}

Definition at line 39 of file Logged.hpp.


The documentation for this class was generated from the following files: