Skip to main content

shutdown

Macro shutdown 

Source
macro_rules! shutdown {
    ($($arg:tt)+) => { ... };
}
Expand description

Emits a shutdown sentinel entry and signals the logging service to stop.

This macro sends an entry with crate::logger::Level::Shutdown and the module hardcoded to crate::logger::Module::Server. When the background service receives this entry, it exits its receive loop cleanly.

This must be called during the server’s graceful shutdown sequence, before awaiting [crate::logger::service::LoggerHandler::shutdown_with_grace].

This macro is a no-op if the logger has not been initialized.

§Usage

// In the graceful shutdown sequence:
shutdown!("Waiting to flush remaining entries...");
logger_handle.shutdown_with_grace(10).await;