Function slog_stdlog::scope [] [src]

pub fn scope<SF, R>(logger: Logger, f: SF) -> R where SF: FnOnce() -> R

Execute code in a logging scope

Logging scopes allow using different logger for legacy logging statements in part of the code.

Logging scopes can be nested and are panic safe.

logger is the Logger to use during the duration of f. with_current_logger can be used to build it as a child of currently active logger.

f is a code to be executed in the logging scope.

Note: Thread scopes are thread-local. Each newly spawned thread starts with a global logger, as a current logger.