Crate ts_init

Source
Expand description

Initializes logging based on the specified environment and output configurations.

This function configures the global logging behavior according to the specified outputs and the environment string provided. It supports conditional logging to stderr, files, or journald based on the inputs.

§Arguments

  • outputs - A vector of Option<String> where each element represents an optional output destination. Supported values are file paths and “journald”.
  • env - A string slice that represents the logging environment. It can be a simple level string like “debug” or a detailed filter like “my_crate=info,my_crate::module=debug”.

§Examples

// Output info log of current crate to stderr
ts_init::init(ts_init::env_filter_directive!("info"));

Re-exports§

pub use tracing;
pub use tracing_subscriber;

Modules§

layer
prelude

Macros§

crate_envDeprecated
env_filter_directive
Generates the directive string for tracing_subscriber::filter::EnvFilter based on CARGO_PKG_NAME and CARGO_BIN_NAME at the specified log level.

Structs§

FileMakeWriter

Traits§

TiSubscriberExt

Functions§

builder
Creates a default subscriber builder that outputs logs to stderr.
init
init_loggingDeprecated
subscriber
Creates a default subscriber instance ready to be registered.
try_init