hololink::module::LoggingInterfaceV1
hololink::module::LoggingInterfaceV1
Application-wide sink for log messages.
The host application implements this interface (see logging_impl.cpp) and publishes it to loaded modules; this way all the loaded modules send their logging messages to the same application receiver.
Code within this framework normally logs through the HSB_LOG_TRACE, HSB_LOG_DEBUG, HSB_LOG_INFO, HSB_LOG_WARN and HSB_LOG_ERROR macros, which compare against level() before formatting the message and then call log() with the call site’s file, line and function.
Inherits from: hololink::module::Service< LoggingInterfaceV1 > (public)
Methods
level
Returns the current setting for log level filtering.
A message should be sent to log() only if its level is greater than or equal to this value. Callers check this before building the message so that disabled log statements cost no formatting work. log() does not itself discard messages below this threshold.
Returns: The current threshold.
log
Deliver one fully formatted log message to the sink.
The sink decorates the message with its own metadata (for example severity, timestamp and thread) and writes it to its destination. This may be called concurrently from multiple threads. All pointer arguments must be non-null, NUL-terminated strings, and are only valid for the duration of the call.
Parameters
Severity of the message.
Source file of the call site.
Line number of the call site.
Name of the function containing the call site.
The text to log; no further formatting is applied.
module
The Module that this service was published from.
The service holds no strong reference to its Module, so this does not extend the Module’s lifetime.
Returns: The owning Module, or an empty pointer if the service has not been published or its Module no longer exists.
Static methods
get_service
Fetch the process-wide logger from a module
Overload 2
Fetch the process-wide logger from a module.
There is only one logger, so no instance identifier is needed.
Returns: A shared pointer to the logger.
Parameters
The module to query.
If false (the default), throws std::runtime_error when the module doesn’t provide a logger (or module is null). If true, returns nullptr instead.
for_each_type_id
Iterate over every type_id supported by this instance.
The callback signature is bool(const char*) — returning false halts the walk; true continues. Iteration is depth-first, so you’ll see the most specific implementation types first.