Expand description
§A modular pretty logger for Rust
Created with the philosophy to be minimum but extensible everything (except core) is a feature, every configuration is defined in compiler-level to minimal run-time overhead.
§Usage
Simplest as possible, works like a std::println!
(more exatcly as a std::eprintln!
):
use plog::{info, ok};
use std::{thread, time::Duration};
let threads: Vec<_> = (0..=10)
.map(|id| {
info!("Creating thread {id}");
thread::spawn(move || {
thread::sleep(Duration::from_millis(1000));
ok!("Thread {id} terminated");
})
})
.collect();
threads.into_iter().for_each(|thr| thr.join().unwrap());
§Features
All the available features are listed here
Modules§
- impls
- macros
- Core of the library.
Contains the front-end to
plog::log
, formating arguments and applying features defined at compile-time
Macros§
- context
- core_
log - debug
- A debugging logger, just will compile the log message when
debug_assert
is enabled - error
- An error logger, the highest importancy level, for things that will affect the program use
- info
- An info logger, the lowest importancy level
- log
- Log formatter, apply every formating feature enabled:
- ok
- Success logger, for things that is working. The “release version” of
plog::debug!
Also works ondebug_assert
- warn
- A warn logger, for things that don’t affect the program flow
Functions§
- log
- Log handler
Checks the enabled features and write to specified streams
persistent
enable write to a filecolored
enable colored output to terminal