Expand description

Simple logger implementation that works using targets.

Instead of needing multiple logging crates to log to multiple targets this crate provides a layer of abstraction and a few default targets. A target has to implement the Target trait.

To start logging, create the Logger object either statically or dynamically and then call one of its init_ methods.

For example, for a dynamic logger (requires std feature):

use edwardium_logger::targets::stderr::StderrTarget;
let logger = edwardium_logger::Logger::new(
	StderrTarget::new(log::Level::Trace, Default::default()),
	std::time::Instant::now()
);
logger.init_boxed().expect("Could not initialize logger");

Logger can also be created and set statically, though this has a few caveats (read the documentation of Logger::new for more):

use edwardium_logger::{
	targets::{stderr::StderrTarget, util::ignore_list::IgnoreList},
	timing::DummyTiming
};
static LOGGER: edwardium_logger::Logger<(StderrTarget), DummyTiming> =
	edwardium_logger::Logger {
		targets: StderrTarget::new(log::Level::Trace, IgnoreList::EMPTY_PATTERNS),
		start: DummyTiming
	};
LOGGER.init_static();

Modules

This module contains provided implementations of logging targets.

Structs

Logger