numerical-collection-cpp 0.10.0
A collection of algorithms in numerical analysis implemented in C++
Loading...
Searching...
No Matches
num_collect::logging Namespace Reference

Namespace of logging. More...

Namespaces

namespace  concepts
 Namespace of C++ concepts.
 
namespace  config
 Namespace of logging configuration.
 
namespace  formatters
 Namespace of formatters of logs.
 
namespace  impl
 Namespace of internal implementations.
 
namespace  iterations
 Namespace of iteration logs.
 
namespace  sinks
 Namespace of log sinks.
 

Classes

class  log_tag
 Class of tags of logs. More...
 
class  log_tag_config
 Class to hold configurations for log tags. More...
 
class  log_tag_view
 Class of tags of logs without memory management. More...
 
class  logger
 Class of loggers. More...
 
class  logging_mixin
 Class to incorporate logging in algorithms. More...
 
class  logging_proxy
 Proxy class to write logs. More...
 
class  time_stamp
 Class of time stamps. More...
 

Enumerations

enum class  log_level : std::uint8_t {
  trace , debug , iteration , iteration_label ,
  summary , info , warning , error ,
  critical , off
}
 Enumeration of log levels. More...
 

Functions

NUM_COLLECT_EXPORT auto get_config_of (log_tag_view tag) -> log_tag_config
 Get the configuration of a tag.
 
NUM_COLLECT_EXPORT auto get_default_tag_config () -> log_tag_config
 Get the default configuration of log tags.
 
auto get_log_level_str (log_level level) noexcept -> std::string_view
 Get the log level string.
 
NUM_COLLECT_EXPORT void load_logging_config_file (std::string_view filepath)
 Parse and apply configurations of logging from a file.
 
template<std::constructible_from< std::string_view, util::source_info_view > Exception, typename... MessageArgs>
requires (sizeof...(MessageArgs) > 0)
void log_and_throw (util::source_info_view source, const logger &l, fmt::format_string< MessageArgs... > message_format, MessageArgs &&... message_args)
 Write an error log and throw an exception for an error.
 
template<std::constructible_from< std::string_view, util::source_info_view > Exception>
void log_and_throw (util::source_info_view source, const logger &l, std::string_view message)
 Write an error log and throw an exception for an error.
 
template<std::constructible_from< std::string_view, util::source_info_view > Exception, typename... MessageArgs>
requires (sizeof...(MessageArgs) > 0)
void log_and_throw (util::source_info_view source, fmt::format_string< MessageArgs... > message_format, MessageArgs &&... message_args)
 Write an error log and throw an exception for an error.
 
template<std::constructible_from< std::string_view, util::source_info_view > Exception>
void log_and_throw (util::source_info_view source, std::string_view message)
 Write an error log and throw an exception for an error.
 
NUM_COLLECT_EXPORT void set_config_of (log_tag_view tag, const log_tag_config &config)
 Set the configuration of a tag.
 
NUM_COLLECT_EXPORT void set_default_tag_config (const log_tag_config &config)
 Set the default configuration of log tags.
 

Variables

constexpr auto default_tag = log_tag_view("")
 Default log tag.
 

Detailed Description

Namespace of logging.

Enumeration Type Documentation

◆ log_level

enum class num_collect::logging::log_level : std::uint8_t
strong

Enumeration of log levels.

Log level Usage in this library
trace Internal trace logs for developer of this library.
debug Log for debugging.
iteration Log of each iteration.
iteration_label Label of iteration logs. (Not usable for output log level.)
summary Summary of calculations.
info None. (Meant for use in user code to show some information.)
warning Warnings of undesirable conditions.
error Errors preventing further processing. (Usually used with exceptions.)
critical None. (Meant for use in conditions which may cause death of processes.)
off Turn off output. (Only for output log level.)
Enumerator
trace 

Trace.

debug 

Debug.

iteration 

Iteration.

iteration_label 

Label of iterations.

summary 

Summary.

info 

Information.

warning 

Warning.

error 

Error.

critical 

Critical.

off 

Turn off output. (Only for output log level).

Definition at line 47 of file log_level.h.

Function Documentation

◆ get_config_of()

NUM_COLLECT_EXPORT auto num_collect::logging::get_config_of ( log_tag_view tag) -> log_tag_config
nodiscard

Get the configuration of a tag.

Parameters
[in]tagTag.
Returns
Configuration.

◆ get_default_tag_config()

NUM_COLLECT_EXPORT auto num_collect::logging::get_default_tag_config ( ) -> log_tag_config
nodiscard

Get the default configuration of log tags.

Returns
Default configuration of log tags.

◆ get_log_level_str()

auto num_collect::logging::get_log_level_str ( log_level level) -> std::string_view
inlinenodiscardnoexcept

Get the log level string.

Parameters
[in]levelLog level.
Returns
String.

Definition at line 85 of file log_level.h.

◆ load_logging_config_file()

NUM_COLLECT_EXPORT void num_collect::logging::load_logging_config_file ( std::string_view filepath)

Parse and apply configurations of logging from a file.

Parameters
[in]filepathFile path.

◆ log_and_throw() [1/4]

template<std::constructible_from< std::string_view, util::source_info_view > Exception, typename... MessageArgs>
requires (sizeof...(MessageArgs) > 0)
void num_collect::logging::log_and_throw ( util::source_info_view source,
const logger & l,
fmt::format_string< MessageArgs... > message_format,
MessageArgs &&... message_args )

Write an error log and throw an exception for an error.

Template Parameters
ExceptionType of the exception.
MessageArgsTypes of arguments for formatting of the error message.
Parameters
[in]sourceInformation of the source code.
[in]lLogger.
[in]message_formatFormat of the error message.
[in]message_argsArguments for formatting of the error message.

Definition at line 104 of file logging_macros.h.

◆ log_and_throw() [2/4]

template<std::constructible_from< std::string_view, util::source_info_view > Exception>
void num_collect::logging::log_and_throw ( util::source_info_view source,
const logger & l,
std::string_view message )

Write an error log and throw an exception for an error.

Template Parameters
ExceptionType of the exception.
Parameters
[in]sourceInformation of the source code.
[in]lLogger.
[in]messageError message.

Definition at line 84 of file logging_macros.h.

◆ log_and_throw() [3/4]

template<std::constructible_from< std::string_view, util::source_info_view > Exception, typename... MessageArgs>
requires (sizeof...(MessageArgs) > 0)
void num_collect::logging::log_and_throw ( util::source_info_view source,
fmt::format_string< MessageArgs... > message_format,
MessageArgs &&... message_args )

Write an error log and throw an exception for an error.

Template Parameters
ExceptionType of the exception.
MessageArgsTypes of arguments for formatting of the error message.
Parameters
[in]sourceInformation of the source code.
[in]message_formatFormat of the error message.
[in]message_argsArguments for formatting of the error message.

Definition at line 142 of file logging_macros.h.

◆ log_and_throw() [4/4]

template<std::constructible_from< std::string_view, util::source_info_view > Exception>
void num_collect::logging::log_and_throw ( util::source_info_view source,
std::string_view message )

Write an error log and throw an exception for an error.

Template Parameters
ExceptionType of the exception.
Parameters
[in]sourceInformation of the source code.
[in]messageError message.

Definition at line 123 of file logging_macros.h.

◆ set_config_of()

NUM_COLLECT_EXPORT void num_collect::logging::set_config_of ( log_tag_view tag,
const log_tag_config & config )

Set the configuration of a tag.

Parameters
[in]tagTag.
[in]configConfiguration.

◆ set_default_tag_config()

NUM_COLLECT_EXPORT void num_collect::logging::set_default_tag_config ( const log_tag_config & config)

Set the default configuration of log tags.

Parameters
[in]configConfiguration.

Variable Documentation

◆ default_tag

auto num_collect::logging::default_tag = log_tag_view("")
constexpr

Default log tag.

Definition at line 123 of file logger.h.