Ditto  1.0.19
Public Types | Static Public Member Functions | List of all members
ditto::Log Class Reference

Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure. More...

Public Types

typedef void(* Callback) (LogLevel, std::string)
 

Static Public Member Functions

static void e (std::string const &message)
 
static void w (std::string const &message)
 
static void i (std::string const &message)
 
static void d (std::string const &message)
 
static void v (std::string const &message)
 
static void process_log_message (LogLevel log_level, std::string const &message)
 
static bool get_logging_enabled ()
 
static void set_logging_enabled (bool enabled)
 
static bool get_emoji_log_level_headings_enabled ()
 
static void set_emoji_log_level_headings_enabled (bool enabled)
 
static LogLevel get_minimum_log_level ()
 
static void set_minimum_log_level (LogLevel log_level)
 
static void set_log_file (std::string const &log_file_path)
 Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console). More...
 
static void disable_log_file ()
 Disables logging to the previously set log file.
 
static void set_custom_log_cb (Callback log_cb)
 Registers a callback for a fully customizable way of handling log "events" from the logger (on top of logging to the console, and to a file, if any). More...
 

Detailed Description

Main singleton (global instance) to tweak the behavior of Ditto's logging infrastructure.

Member Function Documentation

◆ get_emoji_log_level_headings_enabled()

bool ditto::Log::get_emoji_log_level_headings_enabled ( )
static

Get whether logging levels are signified using emoji headings.

◆ get_logging_enabled()

bool ditto::Log::get_logging_enabled ( )
static

Get whether logging is enabled or not.

◆ get_minimum_log_level()

LogLevel ditto::Log::get_minimum_log_level ( )
static

Get the minimum log level at which logging should be occurring.

◆ set_custom_log_cb()

void ditto::Log::set_custom_log_cb ( Log::Callback  log_cb)
static

Registers a callback for a fully customizable way of handling log "events" from the logger (on top of logging to the console, and to a file, if any).

Parameters
[in]log_cba callback that is called each time a log statement is issued by Ditto (after filtering by log level).

◆ set_emoji_log_level_headings_enabled()

void ditto::Log::set_emoji_log_level_headings_enabled ( bool  enabled)
static

Set whether logging levels are signified using emoji headings.

Parameters
[in]enableda bool representing whether logging levels are to be signified using emoji headings.

◆ set_log_file()

void ditto::Log::set_log_file ( std::string const &  log_file_path)
static

Registers a file path where logs will be written to, whenever Ditto wants to issue a log (on top of emitting the log to the console).

Parameters
[in]log_file_paththe file path to be used to write logs at (the file path must be within an already existing directory).

◆ set_logging_enabled()

void ditto::Log::set_logging_enabled ( bool  enabled)
static

Set whether Ditto logging is enabled or not.

Parameters
[in]enableda bool representing whether logging should be enabled or not.

◆ set_minimum_log_level()

void ditto::Log::set_minimum_log_level ( LogLevel  log_level)
static

Set the minimum log level at which logging should be occurring.

Parameters
[in]log_levelthe minimum logging level at which logging should be occurring.