Crate logs[−][src]
Example
use logs::{debug, error, info, trace, warn}; debug!("This is a debug log"); trace!("This is a trace log"); info!("This is a info log"); warn!("This is a warn log"); error!("This is a error log");
Config
use logs::{LogConfig, debug, error}; let mut config = LogConfig::disable_all(); // Disable debug! output config.debug(false); // Allow error! output config.error(true); // The output of `trace!` is only displayed in debug mode #[cfg(debug_assertions)] config.trace(true); // Change datetime format: [Fri Nov 27 15:56:08 2020] config.date_format("%c").unwrap(); config.build(); debug!("This is a debug log"); error!("This is a error log");
env
This can be configured by reading the LOG
environment variable, which disables all output by default
# Enable all output
# Disable debug output
# ...
export LOG='all,!debug,info,!error'
use logs::LogConfig; LogConfig::from_env().unwrap_or_default().build();
Macros
debug | |
error | |
info | |
trace | |
warn |
Structs
LogConfig | Configuration Log |
Enums
LogError | Log Error |