6 #ifndef METALL_LOGGER_HPP
7 #define METALL_LOGGER_HPP
35 static void out(
const level lvl,
const char*
const file_name,
36 const int line_no,
const char*
const message) noexcept {
41 static void perror(
const level lvl,
const char*
const file_name,
42 const int line_no,
const char*
const message) noexcept {
44 ss << message <<
": " << strerror(errno);
46 auto const m = ss.str();
57 #ifndef METALL_LOGGER_EXTERN_C
61 std::optional<level> inner;
63 explicit level_filter(std::optional<level> inner) noexcept : inner{inner} {
84 return inner.has_value() && lvl >= *inner;
90 return log_message_out_level;
95 log_message_out_level = lvl;
100 return abort_on_critical;
105 abort_on_critical = enable;
109 static level_filter log_message_out_level;
110 static bool abort_on_critical;
114 #ifndef METALL_LOGGER_EXTERN_C
124 inline bool logger::abort_on_critical =
true;
130 #ifndef METALL_LOGGER_EXTERN_C
141 std::cerr << file_name <<
" at line " << line_no <<
" --- " << message
void metall_log(metall_log_level lvl_, const char *file_name, size_t line_no, const char *message)
Implementation of logging behaviour.
Definition: logger.hpp:133
metall_log_level
Log message level.
Definition: logger_interface.h:9
@ metall_debug
Debug logger message.
Definition: logger_interface.h:19
@ metall_critical
Critical logger message.
Definition: logger_interface.h:11
@ metall_error
Error logger message.
Definition: logger_interface.h:13
@ metall_warning
Warning logger message.
Definition: logger_interface.h:15
@ metall_verbose
Verbose (lowest priority) logger message.
Definition: logger_interface.h:21
@ metall_info
Info logger message.
Definition: logger_interface.h:17