Crate elara_log

Source
Expand description

This crate provides basic logging capabilities for the Project Elara suite of open-source software libraries. It can also be used as a general-purpose lightweight logging library. It has just five logging macros:

debug!(some_debug_message)
error!(some_error_message)
info!(some_info_message)
success!(some_success_message)
warn!(some_success_message)

The macros accept the same format strings as println! which allows using string substitutions:

info!("The Answer to {} is {}.", 
	  "the Ultimate Question of Life, the Universe, and Everything", 
	  "42");

To use it in your project, install it with cargo by running:

# this crate is listed under a different
# name to avoid a naming clash with a previous
# deprecated version of the same library
cargo add elara-log-ng

Then import the crate and initialize the logger in your main() before calling any of the logging macros:

// required in all cases
// (including if you're using
// elara-log in a library)
use elara_log::prelude::*;

fn main() {
	// for executables/applications only
	// add this before calling any of
	// the logging macros
	Logger::new().init().unwrap();
}

Modules§

prelude

Macros§

debug
error
info
success
warn

Structs§

Logger
LoggerInitError

Enums§

LogLevel

Traits§

Log

Functions§

logger
set_logger