Class nebula::drivers::loggers::Logger
ClassList > nebula > drivers > loggers > Logger
#include <logger.hpp>
Inherited by the following classes: nebula::drivers::loggers::ConsoleLogger, nebula::drivers::loggers::RclcppLogger
Classes
| Type | Name |
|---|---|
| class | Filtered A view of a logger that either forwards or drops messages. |
Public Functions
| Type | Name |
|---|---|
| virtual std::shared_ptr< Logger > | child (const std::string & name) = 0 |
| virtual void | debug (const std::string & message) = 0 |
| virtual void | error (const std::string & message) = 0 |
| virtual void | info (const std::string & message) = 0 |
| Filtered | once (const char * file=__builtin_FILE(), uint32_t line=__builtin_LINE()) Log only the first time the calling line of code is reached. |
| Filtered | throttled (std::chrono::nanoseconds period, const char * file=__builtin_FILE(), uint32_t line=__builtin_LINE()) Log at most once per period from the calling line of code. |
| virtual void | warn (const std::string & message) = 0 |
| virtual | ~Logger () = default |
Protected Functions
| Type | Name |
|---|---|
| virtual uint64_t | steady_now_ns () const The time used for throttling, in nanoseconds since an arbitrary, fixed point in time. |
Public Functions Documentation
function child
virtual std::shared_ptr< Logger > nebula::drivers::loggers::Logger::child (
const std::string & name
) = 0
function debug
virtual void nebula::drivers::loggers::Logger::debug (
const std::string & message
) = 0
function error
virtual void nebula::drivers::loggers::Logger::error (
const std::string & message
) = 0
function info
virtual void nebula::drivers::loggers::Logger::info (
const std::string & message
) = 0
function once
Log only the first time the calling line of code is reached.
inline Filtered nebula::drivers::loggers::Logger::once (
const char * file=__builtin_FILE(),
uint32_t line=__builtin_LINE()
)
The state is kept per logger instance and per call site (file and line), so two objects with their own loggers each log once. Do not pass file and line, they identify the call site.
logger->once().warn("Unsupported firmware, skipping object lists");
Returns:
A view that forwards messages on the first call, and drops them afterwards
function throttled
Log at most once per period from the calling line of code.
inline Filtered nebula::drivers::loggers::Logger::throttled (
std::chrono::nanoseconds period,
const char * file=__builtin_FILE(),
uint32_t line=__builtin_LINE()
)
The first call passes. The state is kept per logger instance and per call site (file and line), so two objects with their own loggers are throttled independently. Do not pass file and line, they identify the call site.
logger->throttled(5s).warn("Dropping malformed packet");
Parameters:
periodThe minimum time between two messages that are let through
Returns:
A view that forwards messages if this call passed the throttle, and drops them if not
function warn
virtual void nebula::drivers::loggers::Logger::warn (
const std::string & message
) = 0
function ~Logger
virtual nebula::drivers::loggers::Logger::~Logger () = default
Protected Functions Documentation
function steady_now_ns
The time used for throttling, in nanoseconds since an arbitrary, fixed point in time.
inline virtual uint64_t nebula::drivers::loggers::Logger::steady_now_ns () const
The documentation for this class was generated from the following file src/nebula_core/nebula_core_common/include/nebula_core_common/loggers/logger.hpp