Struct tinylog::Config[][src]

pub struct Config { /* fields omitted */ }
Expand description

Used to configure logging.

This is returned from tinylog::config().

Implementations

Set the default log level.

If RUST_LOG is set, it will override this. You can use Config::level to ignore RUST_LOG.

Example

tinylog::config()
	.default_level(LevelFilter::Warn)
	.init();

Set the log level, ignoring RUST_LOG.

Example

tinylog::config()
	.level(LevelFilter::Warn)
	.init();

Filter logs.

Example

tinylog::config()
	.filter(|metadata| {
		// only show logs from this binary
		metadata.target().starts_with(module_path!())
	})
	.init();

Set the color level.

If this is set, color support won’t be determined with atty. The environment variables NO_COLOR and FORCE_COLOR will still apply, however.

Example

tinylog::config()
	// never output colors
	.color(ColorChoice::Never)
	.init();

Initialize the logger.

Any logs that occur before this are ignored.

Example

// equivalent to tinylog::init();
tinylog::config().init();

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.