lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::log Namespace Reference

Collection of logging utilities. More...

Enumerations

enum class  LoggerType
 Enum used to differentiate between loggers that output to stdout and stderr.
 

Functions

std::shared_ptr< spdlog::logger > get_logger (LoggerType logger_type)
 Get a logger of the specified type.
 
void set_logger_sink (spdlog::custom_log_callback cb)
 Replace the standard logger sink with a custom callback.
 
void set_logger_sink (std::function< void(std::string)> cb)
 Replace the standard logger sink with a custom callback.
 
void set_pattern (const std::string &format)
 Set the format of the logger.
 
void clear_logger ()
 Clear the logger, removing all loggers and their sinks.
 
void set_verbosity_level (spdlog::level::level_enum level)
 Set the verbosity level of the logger.
 
void set_verbosity_level (int level)
 Set the verbosity level of the logger.
 

Detailed Description

Collection of logging utilities.

Function Documentation

◆ clear_logger()

void lucid::log::clear_logger ( )

Clear the logger, removing all loggers and their sinks.

This will remove all loggers created by get_logger and set_logger_sink. After this call, the loggers will need to be recreated using get_logger.

◆ get_logger()

std::shared_ptr< spdlog::logger > lucid::log::get_logger ( LoggerType logger_type)

Get a logger of the specified type.

If the logger does not exist, it will be created.

Parameters
logger_typestdout or stderr logger
Returns
shared pointer to the logger

◆ set_logger_sink() [1/2]

void lucid::log::set_logger_sink ( spdlog::custom_log_callback cb)

Replace the standard logger sink with a custom callback.

This action can be undone by calling clear_logger.

Note
The logger will no longer output to stdout or stderr, unless cb explicitly does so.
Parameters
cbcustom callback that will be called with the log message

◆ set_logger_sink() [2/2]

void lucid::log::set_logger_sink ( std::function< void(std::string)> cb)

Replace the standard logger sink with a custom callback.

This action can be undone by calling clear_logger.

Note
The logger will no longer output to stdout or stderr, unless cb explicitly does so.
Parameters
cbcustom callback that will be called with the log message

◆ set_pattern()

void lucid::log::set_pattern ( const std::string & format)

Set the format of the logger.

This will replace the default format [%Y-%m-%d %H:%M:%S.%e] [%^l%$] [thread %t] %v.

Note
See spdlog's documentation for more information on the format string.
Parameters
formatformat string to use for the logger

◆ set_verbosity_level() [1/2]

void lucid::log::set_verbosity_level ( int level)

Set the verbosity level of the logger.

Parameters
levelverbosity level to set

◆ set_verbosity_level() [2/2]

void lucid::log::set_verbosity_level ( spdlog::level::level_enum level)

Set the verbosity level of the logger.

Parameters
levelverbosity level to set