My Project
|
Logger instance used to make log messages. More...
#include <uuid/log.h>
Public Member Functions | |
Logger (const __FlashStringHelper *name, Facility facility=Facility::LOCAL0) | |
Create a new logger with the given name and logging facility. More... | |
bool | enabled (Level level) const |
Determine if the specified log level is enabled by the effective log level. More... | |
Facility | facility () const |
Get the default logging facility for new messages of this logger. More... | |
Level | level () const |
Get the log level. More... | |
void | level (Level level) |
Set the log level. More... | |
Level | effective_level () const |
Get the effective log level. More... | |
void | emerg (const char *format,...) const |
Log a message at level Level::EMERG. More... | |
void | emerg (const __FlashStringHelper *format,...) const |
Log a message at level Level::EMERG. More... | |
void | alert (const char *format,...) const |
Log a message at level Level::ALERT. More... | |
void | alert (const __FlashStringHelper *format,...) const |
Log a message at level Level::ALERT. More... | |
void | crit (const char *format,...) const |
Log a message at level Level::CRIT. More... | |
void | crit (const __FlashStringHelper *format,...) const |
Log a message at level Level::CRIT. More... | |
void | err (const char *format,...) const |
Log a message at level Level::ERR. More... | |
void | err (const __FlashStringHelper *format,...) const |
Log a message at level Level::ERR. More... | |
void | warning (const char *format,...) const |
Log a message at level Level::WARNING. More... | |
void | warning (const __FlashStringHelper *format,...) const |
Log a message at level Level::WARNING. More... | |
void | notice (const char *format,...) const |
Log a message at level Level::NOTICE. More... | |
void | notice (const __FlashStringHelper *format,...) const |
Log a message at level Level::NOTICE. More... | |
void | info (const char *format,...) const |
Log a message at level Level::INFO. More... | |
void | info (const __FlashStringHelper *format,...) const |
Log a message at level Level::INFO. More... | |
void | debug (const char *format,...) const |
Log a message at level Level::DEBUG. More... | |
void | debug (const __FlashStringHelper *format,...) const |
Log a message at level Level::DEBUG. More... | |
void | trace (const char *format,...) const |
Log a message at level Level::TRACE. More... | |
void | trace (const __FlashStringHelper *format,...) const |
Log a message at level Level::TRACE. More... | |
void | log (Level level, const char *format,...) const |
Log a message with default facility. More... | |
void | log (Level level, const __FlashStringHelper *format,...) const |
Log a message with default facility. More... | |
void | log (Level level, Facility facility, const char *format,...) const |
Log a message with a custom facility. More... | |
void | log (Level level, Facility facility, const __FlashStringHelper *format,...) const |
Log a message with a custom facility. More... | |
void | vlog (Level level, const char *format, va_list ap) const |
Log a message at the specified level. More... | |
void | vlog (Level level, const __FlashStringHelper *format, va_list ap) const |
Log a message at the specified level. More... | |
void | vlog (Level level, Facility facility, const char *format, va_list ap) const |
Log a message at the specified level and facility. More... | |
void | vlog (Level level, Facility facility, const __FlashStringHelper *format, va_list ap) const |
Log a message at the specified level and facility. More... | |
void | logp (Level level, const char *text) const |
Log a plain message (without formatting) at the specified level. More... | |
void | logp (Level level, Facility facility, const char *text) const |
Log an plain message (without formatting) at the specified level and facility. More... | |
Static Public Member Functions | |
static void | register_handler (Handler *handler, Level level) |
Register a log handler. More... | |
static void | unregister_handler (Handler *handler) |
Unregister a log handler. More... | |
static Level | get_log_level (const Handler *handler) |
Get the current log level of a handler. More... | |
static Level | global_level () |
Get the current global log level. More... | |
Static Public Attributes | |
static constexpr size_t | MAX_LOG_LENGTH = 255 |
This is the maximum length of any log message. More... | |
Private Member Functions | |
void | vlog_internal (Level level, Facility facility, const char *format, va_list ap) const |
Log a message at the specified level and facility without checking that the specified level is enabled. More... | |
void | vlog_internal (Level level, Facility facility, const __FlashStringHelper *format, va_list ap) const |
Log a message at the specified level and facility without checking that the specified level is enabled. More... | |
void | dispatch (Level level, Facility facility, std::vector< char > &text) const |
Dispatch a log message to all handlers that are registered to handle messages of the specified level. More... | |
void | dispatch (const std::shared_ptr< Message > &message) const |
Dispatch a log message to all handlers that are registered to handle messages of the specified level. More... | |
Static Private Member Functions | |
static void | refresh_log_level () |
Refresh the minimum global log level across all handlers. More... | |
static std::shared_ptr< std::map< Handler *, Level > > & | registered_handlers () |
Get registered log handlers. More... | |
Private Attributes | |
const __FlashStringHelper * | name_ |
const Facility | facility_ |
Level | local_level_ {Level::ALL} |
Static Private Attributes | |
static std::atomic< Level > | global_level_ {Level::OFF} |
static std::mutex | mutex_ |
|
explicit |
void uuid::log::Logger::alert | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::alert | ( | const char * | format, |
... | |||
) | const |
void uuid::log::Logger::crit | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::crit | ( | const char * | format, |
... | |||
) | const |
void uuid::log::Logger::debug | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::debug | ( | const char * | format, |
... | |||
) | const |
|
inlineprivate |
|
private |
Dispatch a log message to all handlers that are registered to handle messages of the specified level.
Automatically sets the timestamp of the message to the current system uptime.
[in] | level | Severity level of the message. |
[in] | facility | Facility type of the process logging the message. |
[in] | text | Log message text. |
|
inline |
void uuid::log::Logger::emerg | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::emerg | ( | const char * | format, |
... | |||
) | const |
|
inline |
void uuid::log::Logger::err | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::err | ( | const char * | format, |
... | |||
) | const |
|
inline |
|
inlinestatic |
void uuid::log::Logger::info | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::info | ( | const char * | format, |
... | |||
) | const |
|
inline |
|
inline |
void uuid::log::Logger::log | ( | Level | level, |
const __FlashStringHelper * | format, | ||
... | |||
) | const |
void uuid::log::Logger::log | ( | Level | level, |
const char * | format, | ||
... | |||
) | const |
void uuid::log::Logger::logp | ( | Level | level, |
const char * | text | ||
) | const |
void uuid::log::Logger::notice | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::notice | ( | const char * | format, |
... | |||
) | const |
|
staticprivate |
void uuid::log::Logger::trace | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::trace | ( | const char * | format, |
... | |||
) | const |
|
static |
void uuid::log::Logger::vlog | ( | Level | level, |
const __FlashStringHelper * | format, | ||
va_list | ap | ||
) | const |
void uuid::log::Logger::vlog | ( | Level | level, |
const char * | format, | ||
va_list | ap | ||
) | const |
void uuid::log::Logger::vlog | ( | Level | level, |
Facility | facility, | ||
const __FlashStringHelper * | format, | ||
va_list | ap | ||
) | const |
Log a message at the specified level and facility.
[in] | level | Severity level of the message. |
[in] | facility | Facility type of the process logging the message. |
[in] | format | Format string (flash string). |
[in] | ap | Variable arguments pointer for format string. |
|
private |
Log a message at the specified level and facility without checking that the specified level is enabled.
[in] | level | Severity level of the message. |
[in] | facility | Facility type of the process logging the message. |
[in] | format | Format string (flash string). |
[in] | ap | Variable arguments pointer for format string. |
|
private |
Log a message at the specified level and facility without checking that the specified level is enabled.
[in] | level | Severity level of the message. |
[in] | facility | Facility type of the process logging the message. |
[in] | format | Format string. |
[in] | ap | Variable arguments pointer for format string. |
void uuid::log::Logger::warning | ( | const __FlashStringHelper * | format, |
... | |||
) | const |
void uuid::log::Logger::warning | ( | const char * | format, |
... | |||
) | const |
|
private |
|
staticprivate |
|
private |
|
staticconstexpr |
|
staticprivate |
|
private |