neic-glass3  1.4.6
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
glass3::util::Logger Class Reference

glassutil logging class More...

#include <logger.h>

Collaboration diagram for glass3::util::Logger:
Collaboration graph

Public Member Functions

 Logger ()
 Logger constructor. More...
 
 ~Logger ()
 Logger destructor. More...
 

Static Public Member Functions

static void disable ()
 Logger disable logging function. More...
 
static void enable ()
 Logger enable logging function. More...
 
static spdlog::level::level_enum string_to_log_level (const std::string &levelString)
 convert string level to spdlog level More...
 
static void log_init (const std::string &programName, const std::string &logLevel, const std::string &logPath, bool logConsole=true)
 initialize logging More...
 
static void log_update_level (spdlog::level::level_enum loglevel)
 update log level More...
 
static void log_update_level (const std::string &levelString)
 update log level More...
 
static void log (const char *logMessage)
 logging function More...
 
static void log (const std::string &level, const char *logMessage)
 logging function More...
 
static void log (std::string logMessage)
 logging function More...
 
static void log (const std::string &level, const std::string &message)
 log a message More...
 
static void logInfo (const std::string &message)
 log a message at info level More...
 
static void logTrace (const std::string &message)
 log a message at trace level More...
 
static void logDebug (const std::string &message)
 log a message at debug level More...
 
static void logWarning (const std::string &message)
 log a message at warning level More...
 
static void logError (const std::string &message)
 log a message at error level More...
 
static void logCriticalError (const std::string &message)
 log a message at critical error level More...
 

Static Public Attributes

static bool m_bDisable = false
 A boolean flag to disable all logging. More...
 
static const unsigned int k_nMaxLogEntrySize = 1024
 The maximum size of a constructed (via sprintf) log entry. More...
 

Detailed Description

glassutil logging class

The Logger class encapsulates the logic and functionality needed to write logging information to disk.

Constructor & Destructor Documentation

glass3::util::Logger::Logger ( )

Logger constructor.

The constructor for the Logger class.

glass3::util::Logger::~Logger ( )

Logger destructor.

The destructor for the Logger class.

Member Function Documentation

void glass3::util::Logger::disable ( )
static

Logger disable logging function.

void glass3::util::Logger::enable ( )
static

Logger enable logging function.

void glass3::util::Logger::log ( const char *  logMessage)
static

logging function

Function to log error and status messages. If the optional logging callback is not set up, this function will use printf. This function logs all messages at the log_level::debug level.

Parameters
logMessage- A char * containing the logging message
void glass3::util::Logger::log ( const std::string &  level,
const char *  logMessage 
)
static

logging function

Function to log error and status messages. If the optional logging callback is not set up, this function will use printf

Parameters
level- A std::string representing the desired log level. Supported levels are: "info", "trace", "debug", "warning", "error", and "criticalerror"
logMessage- A char * containing the logging message
void glass3::util::Logger::log ( std::string  logMessage)
static

logging function

Function to log error and status messages. If the optional logging callback is not set up, this function will use printf. This function logs all messages at the log_level::debug level.

Parameters
logMessage- A std::string containing the logging message
void glass3::util::Logger::log ( const std::string &  level,
const std::string &  message 
)
static

log a message

Log a message with the provided level

See also
string_to_log_level
Parameters
level- A std::string representing the desired log level. Supported levels are: "info", "trace", "debug", "warning", "error", and "criticalerror"
message- A std::string representing the message to log.
void glass3::util::Logger::log_init ( const std::string &  programName,
const std::string &  logLevel,
const std::string &  logPath,
bool  logConsole = true 
)
static

initialize logging

Initialize the logging system for the application, setting whether to log to disk and/or console, and setting the desired minimum logging level

See also
string_to_log_level
Parameters
programName- A std::string containing the name of the program
logLevel- A std::string representing the desired log level, Supported levelString are: "info", "trace", "debug", "warning", "error", and "criticalerror"
logConsole- A boolean flag representing whether to log to console
logPath- A std::string containing the name of path for the log file, empty string disables logging to file.
void glass3::util::Logger::log_update_level ( spdlog::level::level_enum  loglevel)
static

update log level

Update the current log level to the provided spdlog level enum

Parameters
loglevel- A spdlog::level::level_enum representing the desired minimum logging level.
void glass3::util::Logger::log_update_level ( const std::string &  levelString)
static

update log level

Update the current log level to the provided level string, primarily used to update the logging system to a desired minimum logging level after startup

See also
string_to_log_level
Parameters
levelString- A std::string representing the desired log level, Supported levelString are: "info", "trace", "debug", "warning", "error", and "criticalerror"
void glass3::util::Logger::logCriticalError ( const std::string &  message)
static

log a message at critical error level

Log a message at the critical error log level

Parameters
message- A std::string representing the message to log.
void glass3::util::Logger::logDebug ( const std::string &  message)
static

log a message at debug level

Log a message at the debug log level

Parameters
message- A std::string representing the message to log.
void glass3::util::Logger::logError ( const std::string &  message)
static

log a message at error level

Log a message at the error log level

Parameters
message- A std::string representing the message to log.
void glass3::util::Logger::logInfo ( const std::string &  message)
static

log a message at info level

Log a message at the info log level

Parameters
message- A std::string representing the message to log.
void glass3::util::Logger::logTrace ( const std::string &  message)
static

log a message at trace level

Log a message at the trace log level

Parameters
message- A std::string representing the message to log.
void glass3::util::Logger::logWarning ( const std::string &  message)
static

log a message at warning level

Log a message at the warning log level

Parameters
message- A std::string representing the message to log.
spdlog::level::level_enum glass3::util::Logger::string_to_log_level ( const std::string &  levelString)
static

convert string level to spdlog level

This function converts the provided string log level to the spdlog enum equivalent.

Supported logging level strings are: criticalerror - log critical error messages prior to program exit error - log algorithmic error messages warning - log warning messages info - log informational messages debug - log debugging messages, used to debug algorithms trace - log tracing messages, used to trace code execution

Parameters
levelString- A std::string containing the logging level to convert
Returns
Returns a spdlog::level::level_enum containing logging level

Member Data Documentation

const unsigned int glass3::util::Logger::k_nMaxLogEntrySize = 1024
static

The maximum size of a constructed (via sprintf) log entry.

bool glass3::util::Logger::m_bDisable = false
static

A boolean flag to disable all logging.


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