Module logging

Module logging 

Source
Expand description

The logging framework for Nautilus systems.

This module implements a high-performance logging subsystem that operates in a separate thread using an MPSC channel for log message delivery. The system uses reference counting to track active LogGuard instances, ensuring the logging thread completes all pending writes before termination.

§LogGuard Reference Counting

The logging system maintains a global count of active LogGuard instances using an atomic counter (LOGGING_GUARDS_ACTIVE). When a LogGuard is created, the counter is incremented, and when dropped, it’s decremented. When the last LogGuard is dropped (counter reaches zero), the logging thread is properly joined to ensure all buffered log messages are written to their destinations before the process terminates.

The system supports a maximum of 255 concurrent LogGuard instances. Attempting to create more will cause a panic.

Re-exports§

pub use macros::log_debug;
pub use macros::log_error;
pub use macros::log_info;
pub use macros::log_trace;
pub use macros::log_warn;

Modules§

headers
logger
macros
Colored logging macros for enhanced log output with automatic color mapping.
writer

Constants§

CMD
DOC
EVT
RECV
REQ
RES
RPT
SEND

Functions§

init_logging
Initialize logging.
init_tracing
Initialize tracing.
log_task_aborted
Logs that a task was aborted using tracing::debug!.
log_task_awaiting
Logs that a task is being awaited using tracing::debug!.
log_task_error
Logs that there was an error in a task tracing::error!.
log_task_started
Logs that a task has started using tracing::debug!.
log_task_stopped
Logs that a task has stopped using tracing::debug!.
logging_clock_set_realtime_mode
Sets the global logging clock to real-time mode.
logging_clock_set_static_mode
Sets the global logging clock to static mode.
logging_clock_set_static_time
Sets the global logging clock static time with the given UNIX timestamp (nanoseconds).
logging_is_colored
Returns whether the core logger is using ANSI colors.
logging_is_initialized
Returns whether the core logger is enabled.
logging_set_bypass
Sets the logging subsystem to bypass mode.
logging_shutdown
Shuts down the logging subsystem.
map_log_level_to_filter
parse_component_levels
Parses component-specific log levels from a JSON value map.
parse_level_filter_str
Parses a string into a LevelFilter.