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

Class of loggers. More...

#include <num_collect/logging/logger.h>

+ Collaboration diagram for num_collect::logging::logger:

Public Member Functions

 logger ()
 Constructor.
 
 logger (log_tag tag, log_tag_config config)
 Constructor.
 
 logger (log_tag_view tag)
 Constructor.
 
 logger (log_tag_view tag, log_tag_config config)
 Constructor.
 
auto config () const noexcept -> const log_tag_config &
 Get the configuration.
 
auto critical (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a critical log.
 
auto debug (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a debug log.
 
auto error (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a error log.
 
auto info (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a information log.
 
void initialize_child_algorithm_logger (logger &child) noexcept
 Initialize a logger as the logger of the algorithm called from the algorithm of this logger.
 
auto iteration (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a iteration log.
 
auto iteration_label (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a label of iteration logs.
 
auto log (log_level level, util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a log.
 
template<typename... Args>
requires (sizeof...(Args) > 0)
void log_without_condition_check (util::source_info_view source, log_level level, fmt::format_string< Args... > format, Args &&... args) const
 Write a log without check of the condition to write logs.
 
void log_without_condition_check (util::source_info_view source, log_level level, std::string_view body) const
 Write a log without check of the condition to write logs.
 
void set_iterative () const noexcept
 Set this node to an iterative algorithm.
 
auto should_log (log_level level) const noexcept -> bool
 Check whether to write logs with a log level.
 
auto summary (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a summary log.
 
auto tag () const noexcept -> const log_tag &
 Get the log tag.
 
auto trace (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a trace log.
 
auto warning (util::source_info_view source=util::source_info_view()) const noexcept -> logging_proxy
 Write a warning log.
 

Private Attributes

log_level always_output_log_level_
 Minimum log level to output always.
 
log_tag_config config_
 Configuration.
 
impl::iteration_layer_handler iteration_layer_handler_ {}
 Handler of layers of iterations.
 
log_level lowest_output_log_level_
 Lowest log level to output.
 
log_tag tag_
 Tag.
 

Detailed Description

Class of loggers.

Thread Safety
All const member functions (member functions except for initialize_child_algorithm_logger function, constructors, destructor, and assignment operators) are thread safe even for the same object.

For logging, following macros can be used:

Definition at line 145 of file logger.h.

Constructor & Destructor Documentation

◆ logger() [1/4]

num_collect::logging::logger::logger ( )
inline

Constructor.

Definition at line 150 of file logger.h.

◆ logger() [2/4]

num_collect::logging::logger::logger ( log_tag_view tag)
inlineexplicit

Constructor.

Parameters
[in]tagTag.

Definition at line 157 of file logger.h.

◆ logger() [3/4]

num_collect::logging::logger::logger ( log_tag_view tag,
log_tag_config config )
inline

Constructor.

Parameters
[in]tagTag.
[in]configConfiguration.

Definition at line 165 of file logger.h.

◆ logger() [4/4]

num_collect::logging::logger::logger ( log_tag tag,
log_tag_config config )
inline

Constructor.

Parameters
[in]tagTag.
[in]configConfiguration.

Definition at line 174 of file logger.h.

Member Function Documentation

◆ config()

auto num_collect::logging::logger::config ( ) const -> const log_tag_config&
inlinenodiscardnoexcept

Get the configuration.

Returns
Configuration.

Definition at line 194 of file logger.h.

◆ critical()

auto num_collect::logging::logger::critical ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a critical log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 386 of file logger.h.

◆ debug()

auto num_collect::logging::logger::debug ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a debug log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 278 of file logger.h.

◆ error()

auto num_collect::logging::logger::error ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a error log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 371 of file logger.h.

◆ info()

auto num_collect::logging::logger::info ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a information log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 341 of file logger.h.

◆ initialize_child_algorithm_logger()

void num_collect::logging::logger::initialize_child_algorithm_logger ( logger & child)
inlinenoexcept

Initialize a logger as the logger of the algorithm called from the algorithm of this logger.

Parameters
[in]childLogger of the algorithm called from the algorithm of this logger.

Definition at line 212 of file logger.h.

◆ iteration()

auto num_collect::logging::logger::iteration ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a iteration log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.
This class don't take configurations of periods into account.

Definition at line 294 of file logger.h.

◆ iteration_label()

auto num_collect::logging::logger::iteration_label ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a label of iteration logs.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.
This class don't take configurations of periods into account.

Definition at line 310 of file logger.h.

◆ log()

auto num_collect::logging::logger::log ( log_level level,
util::source_info_view source = util::source_info_view() ) const -> logging_proxy
inlinenodiscardnoexcept

Write a log.

Parameters
[in]levelLog level.
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 247 of file logger.h.

◆ log_without_condition_check() [1/2]

template<typename... Args>
requires (sizeof...(Args) > 0)
void num_collect::logging::logger::log_without_condition_check ( util::source_info_view source,
log_level level,
fmt::format_string< Args... > format,
Args &&... args ) const
inline

Write a log without check of the condition to write logs.

Warning
This function should be used with should_log() function.
Template Parameters
ArgsType of arguments.
Parameters
[in]sourceInformation of the source code.
[in]levelLog level.
[in]formatFormat string.
[in]argsArguments for the format string.

Definition at line 420 of file logger.h.

◆ log_without_condition_check() [2/2]

void num_collect::logging::logger::log_without_condition_check ( util::source_info_view source,
log_level level,
std::string_view body ) const
inline

Write a log without check of the condition to write logs.

Warning
This function should be used with should_log() function.
Parameters
[in]sourceInformation of the source code.
[in]levelLog level.
[in]bodyBody.

Definition at line 401 of file logger.h.

◆ set_iterative()

void num_collect::logging::logger::set_iterative ( ) const
inlinenoexcept

Set this node to an iterative algorithm.

Definition at line 201 of file logger.h.

◆ should_log()

auto num_collect::logging::logger::should_log ( log_level level) const -> bool
inlinenodiscardnoexcept

Check whether to write logs with a log level.

Parameters
[in]levelLog level.
Return values
trueShould write logs.
falseShould not write logs.

Definition at line 224 of file logger.h.

◆ summary()

auto num_collect::logging::logger::summary ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a summary log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.
This class don't take configurations of periods into account.

Definition at line 326 of file logger.h.

◆ tag()

auto num_collect::logging::logger::tag ( ) const -> const log_tag&
inlinenodiscardnoexcept

Get the log tag.

Returns
Log tag.

Definition at line 187 of file logger.h.

◆ trace()

auto num_collect::logging::logger::trace ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a trace log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 263 of file logger.h.

◆ warning()

auto num_collect::logging::logger::warning ( util::source_info_view source = util::source_info_view()) const -> logging_proxy
inlinenodiscardnoexcept

Write a warning log.

Parameters
[in]sourceInformation of the source code.
Returns
Proxy object to write log.
Note
Argument source should be left to be the default value if you want to write logs with the current position.

Definition at line 356 of file logger.h.

Member Data Documentation

◆ always_output_log_level_

log_level num_collect::logging::logger::always_output_log_level_
private

Minimum log level to output always.

Definition at line 438 of file logger.h.

◆ config_

log_tag_config num_collect::logging::logger::config_
private

Configuration.

Definition at line 435 of file logger.h.

◆ iteration_layer_handler_

impl::iteration_layer_handler num_collect::logging::logger::iteration_layer_handler_ {}
private

Handler of layers of iterations.

Definition at line 444 of file logger.h.

◆ lowest_output_log_level_

log_level num_collect::logging::logger::lowest_output_log_level_
private

Lowest log level to output.

Definition at line 441 of file logger.h.

◆ tag_

log_tag num_collect::logging::logger::tag_
private

Tag.

Definition at line 432 of file logger.h.


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