pub struct LoggingGuard { /* private fields */ }Expand description
A handle to the dynamic logging subsystem.
Held by BootstrapGuard for the lifetime of the application. Owns the
worker guards (which flush buffered output on drop), and exposes reload for swapping the
entire logging configuration plus controller for driving runtime filter changes through
the override worker.
Implementations§
Source§impl LoggingGuard
impl LoggingGuard
Sourcepub async fn reload(
&mut self,
config: LoggingConfiguration,
) -> Result<(), GenericError>
pub async fn reload( &mut self, config: LoggingConfiguration, ) -> Result<(), GenericError>
Reloads the logging subsystem from the given configuration.
Rebuilds the output layer stack from config and routes the new level filter through the override worker
as the new base filter, so an active override is preserved (the new base will take effect once the override
expires). Worker guards for the previous outputs are dropped after the swap, which flushes any buffered log
lines to their original destinations.
This is the right entry point when the entire logging configuration may have changed (for example, outputs,
format, level). For runtime base-filter changes only – such as following a log_level config update –
use controller and call
update_base directly.
§Errors
Returns an error if the new output layers can’t be constructed (for example, the configured log file path is inaccessible) or if the override worker is no longer running.
Sourcepub fn controller(&self) -> LoggingOverrideController
pub fn controller(&self) -> LoggingOverrideController
Returns a logging override controller that can be used to change the default filter directives.
Auto Trait Implementations§
impl Freeze for LoggingGuard
impl !RefUnwindSafe for LoggingGuard
impl Send for LoggingGuard
impl Sync for LoggingGuard
impl Unpin for LoggingGuard
impl !UnwindSafe for LoggingGuard
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Track for T
impl<T> Track for T
Source§fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
fn track_resources(self, token: ResourceGroupToken) -> Tracked<Self>
Tracked wrapper. Read moreSource§fn in_current_resource_group(self) -> Tracked<Self>
fn in_current_resource_group(self) -> Tracked<Self>
Tracked wrapper. Read more