mousetrap v0.2.0
Loading...
Searching...
No Matches
mousetrap::log Class Reference

uninstantiatable singleton, provides global logging functionality More...

#include <log.hpp>

Public Member Functions

 log ()=delete
 ctor deleted, singleton instance that cannot be instantiated
 

Static Public Member Functions

static void initialize ()
 initiailze the logging suite, automatically called during construction of mousetrap::Application
 
static void debug (const std::string &message, LogDomain=USER_DOMAIN)
 print a debug message, not printed unless set_surpress_debug is set to false
 
static void info (const std::string &message, LogDomain=USER_DOMAIN)
 print a info message, usually reserved to benign logging, printed unless set_surpress_info is set to true
 
static void warning (const std::string &message, LogDomain=USER_DOMAIN)
 print a warning message, appropriate to inform user of unexpected behavior that cannot cause an error
 
static void critical (const std::string &message, LogDomain=USER_DOMAIN)
 inform user of an error, this function does not interrupt runtime
 
static void fatal (const std::string &message, LogDomain=USER_DOMAIN)
 inform user of a critical error, this function will exit runtime
 
static void set_surpress_debug (LogDomain, bool)
 surpress debug level log message for given log domain. true by default
 
static void set_surpress_info (LogDomain, bool)
 surpress info level log message for given log domain. true by default
 
static bool get_surpress_debug (LogDomain)
 get whether debug level log messages are printed for given domain
 
static bool get_surpress_info (LogDomain)
 get whether info level log messages are printed for given domain
 
static bool set_file (const std::string &path)
 specify a log file, any message regardless of priority will be appended to it. File will not be overwritten, if it does not exist, it will be created
 
template<typename Function_t >
static void set_file_formatting_function (Function_t function)
 set formatting function, this functino transforms the log message into a string which will be appended to the log file. This function is not applied to messages printed to cout or cerr
 
static void reset_file_formatting_function ()
 reset formatting function to default
 

Detailed Description

uninstantiatable singleton, provides global logging functionality

Member Function Documentation

◆ critical()

void mousetrap::log::critical ( const std::string &  message,
LogDomain  domain = USER_DOMAIN 
)
static

inform user of an error, this function does not interrupt runtime

Parameters
messagemessage
domainlogging domain, optional

Referenced by mousetrap::Stack::add_child(), mousetrap::Action::add_shortcut(), mousetrap::MenuModel::add_submenu(), mousetrap::Application::Application(), mousetrap::Shape::as_circle(), mousetrap::Shape::as_ellipse(), mousetrap::Shape::as_outline(), mousetrap::AspectFrame::AspectFrame(), mousetrap::MultisampledRenderTexture::bind_as_render_target(), mousetrap::file_system::copy(), mousetrap::file_system::create_file_at(), mousetrap::Image::create_from_file(), mousetrap::ImageDisplay::create_from_file(), mousetrap::KeyFile::create_from_file(), mousetrap::Icon::create_from_file(), mousetrap::Shader::create_from_file(), mousetrap::KeyFile::create_from_string(), mousetrap::Icon::create_from_theme(), mousetrap::FileDescriptor::create_monitor(), mousetrap::file_system::delete_at(), mousetrap::Application::get_action(), mousetrap::Stack::get_child_at(), mousetrap::FileDescriptor::get_children(), mousetrap::ColumnView::get_column_at(), mousetrap::ColumnView::get_column_with_title(), mousetrap::KeyFile::get_comment_above_group(), mousetrap::KeyFile::get_comment_above_key(), mousetrap::KeyFile::get_keys(), mousetrap::Image::get_pixel(), mousetrap::PopoverButton::get_relative_position(), mousetrap::StyleManager::get_style_class(), mousetrap::RenderTask::get_uniform_float(), mousetrap::RenderTask::get_uniform_hsva(), mousetrap::RenderTask::get_uniform_int(), mousetrap::RenderTask::get_uniform_rgba(), mousetrap::RenderTask::get_uniform_transform(), mousetrap::RenderTask::get_uniform_uint(), mousetrap::RenderTask::get_uniform_vec2(), mousetrap::RenderTask::get_uniform_vec3(), mousetrap::RenderTask::get_uniform_vec4(), mousetrap::KeyFile::get_value(), mousetrap::Shape::get_vertex_color(), mousetrap::Shape::get_vertex_position(), mousetrap::KeyFile::has_key(), mousetrap::ListView::insert(), mousetrap::Notebook::insert(), mousetrap::file_system::move(), mousetrap::Notebook::move_page_to(), mousetrap::file_system::move_to_trash(), mousetrap::KeyFile::operator std::string(), mousetrap::Popover::popup(), mousetrap::FileChooser::present(), mousetrap::Notebook::push_back(), mousetrap::ListView::push_back(), mousetrap::Notebook::push_front(), mousetrap::ListView::push_front(), mousetrap::FileDescriptor::query_info(), mousetrap::FileDescriptor::read_symlink(), mousetrap::Stack::remove_child(), mousetrap::KeyFile::save_to_file(), mousetrap::Image::save_to_file(), mousetrap::FlowBox::set_column_spacing(), mousetrap::KeyFile::set_comment_above_group(), mousetrap::KeyFile::set_comment_above_key(), mousetrap::Application::set_current_theme(), mousetrap::ProgressBar::set_fraction(), mousetrap::Image::set_pixel(), mousetrap::AspectFrame::set_ratio(), mousetrap::PopoverButton::set_relative_position(), mousetrap::FlowBox::set_row_spacing(), mousetrap::DropDown::set_selected(), mousetrap::SignalEmitter::set_signal_blocked(), mousetrap::Box::set_spacing(), mousetrap::Shape::set_vertex_color(), mousetrap::Shape::set_vertex_position(), mousetrap::Shape::set_vertex_texture_coordinate(), mousetrap::ColumnView::set_widget_at(), and mousetrap::ListView::set_widget_at().

◆ debug()

void mousetrap::log::debug ( const std::string &  message,
LogDomain  domain = USER_DOMAIN 
)
static

print a debug message, not printed unless set_surpress_debug is set to false

Parameters
messagemessage
domainlogging domain, optional

◆ fatal()

void mousetrap::log::fatal ( const std::string &  message,
LogDomain  domain = USER_DOMAIN 
)
static

inform user of a critical error, this function will exit runtime

Parameters
messagemessage
domainlogging domain, optional

◆ get_surpress_debug()

bool mousetrap::log::get_surpress_debug ( LogDomain  domain)
static

get whether debug level log messages are printed for given domain

Parameters
domainlogging domain
Returns
true if debug messages should be surpressed, false otherwise

◆ get_surpress_info()

bool mousetrap::log::get_surpress_info ( LogDomain  domain)
static

get whether info level log messages are printed for given domain

Parameters
domainlogging domain
Returns
true if info messages should be surpressed, false otherwise

◆ info()

void mousetrap::log::info ( const std::string &  message,
LogDomain  domain = USER_DOMAIN 
)
static

print a info message, usually reserved to benign logging, printed unless set_surpress_info is set to true

Parameters
messagemessage
domainlogging domain, optional

◆ initialize()

void mousetrap::log::initialize ( )
static

initiailze the logging suite, automatically called during construction of mousetrap::Application

Note
This function is not available in the Julia binding

References reset_file_formatting_function().

◆ set_file()

bool mousetrap::log::set_file ( const std::string &  path)
static

specify a log file, any message regardless of priority will be appended to it. File will not be overwritten, if it does not exist, it will be created

Parameters
pathabsolute path
Returns
true if file was succesfully opened for streaming, false otherwise
Note
This function is available as set_log_file in the Julia Binding

◆ set_file_formatting_function()

template<typename Function_t >
void mousetrap::log::set_file_formatting_function ( Function_t  function)
static

set formatting function, this functino transforms the log message into a string which will be appended to the log file. This function is not applied to messages printed to cout or cerr

Template Parameters
Function_tlambda with signatures (const std::string& message, const std::map<std::string, std::string>& fields) -> std::string
Parameters
function
Note
This function is not available in the Julia binding

◆ set_surpress_debug()

void mousetrap::log::set_surpress_debug ( LogDomain  domain,
bool  b 
)
static

surpress debug level log message for given log domain. true by default

Parameters
domainlogging domain
btrue if debug messages should be surpressed, false otherwise

◆ set_surpress_info()

void mousetrap::log::set_surpress_info ( LogDomain  domain,
bool  b 
)
static

surpress info level log message for given log domain. true by default

Parameters
domainlogging domain
btrue if info messages should be surpressed, false otherwise

◆ warning()


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