ducktrace-logger
ducktrace-logger is a duck themed application logging system written in Rust that is configured using environment variables.
It only prints (and saves to ~/.config/duckTrace/) logs at or above $DT_LOG_LEVEL.
It also provides a handy dt_timer for measuring operations.
Installation
Add as a git dependency in your Cargo.toml:
[]
= { = "https://github.com/QuackHack-McBlindy/ducktrace-logger" }
Configuration
The logger can be configured via environment variables (preferred) or programmatically.
Environment variables (easiest)
DT_LOG_LEVEL– set toDEBUG,INFO,WARNING,ERROR, orCRITICAL(default:INFO)DEBUG=1– enable debug messages even if level is higherDT_LOG_PATH– directory for log files (default:~/.config/duckTrace/)DT_LOG_FILE– filename inside that directory (default:unknown-script.log)
Programmatic setup (optional)
If you need to set the log level from code (ignoring env vars), call setup_ducktrace_logging before any logging:
use *;
Basic usage:
use *;
Error output
use *;
This will print to stderr:
The duck line is only shown for Error and Critical levels – it does not appear for Debug, Info, or Warning. It is also not written to the log file, only to the console.