HOW TO USE
ONE: Settings
use LoggerSettings;
let log_settings = LoggerSettings ;
TWO: Initialize
use logger;
THREE: Log
use *;
| SETTING | DESCRIPTION |
|---|---|
terminal_logs |
Log to terminal |
terminal_log_lvl |
Minimum level to display |
file_logs |
Log to file |
file_log_lvl |
Minimum level to write |
log_file_path |
Path to log file |
debug_extra |
show debugx! logs |
async_logging |
Enable async logging |
INFORMATION
- Console logging uses env_logger
- File logging uses the same format as the console logs
trace!-> (debug!,debugx!) ->info!->warn!->error!- better-logger will automatically create the path and file if not already created
- File logs are overwritten not appended
- Async logging uses a “fire and forget” model:
- It spawns a new async task on the current Tokio runtime for each message
- All macros use format! under the hood, any string-like type is accepted
Settings Alternate Namespace
Same exact settings, just a semantic difference
use better_logger::settings::Settings;
let log_settings = Settings {
/* Same as above */
};
What is DEBUGX?
It is just a second debug, the debugx!() logs will be labeled as DEBUG when they print
Why would I want to use DEBUGX?
Let’s say you’re in development, so you want to see all your debug logs. However, some of your debug logs are massive and clutter your terminal.
You can mark those verbose logs as debugx!() and set debug_extra = false to hid them.
Later, if you're troubleshooting or need to view them, set debug_extra = true, and see your extra debug logs!
Future Plans
- Append Setting
- WASM Logging
- Network Logging