mirror of
https://github.com/bitcoinresearchkit/brk.git
synced 2026-06-14 16:53:35 -07:00
brk_logger
Colorful logging utility built on env_logger that provides clean, timestamped console output with optional file logging. This crate wraps env_logger to display logs from the log crate in a readable format with color-coded log levels and configurable filtering to suppress noisy third-party library logs.
Features
- Colorized output: Log levels are color-coded (error=red, warn=yellow, info=green, debug=blue, trace=cyan)
- Timestamps: Each log entry includes a formatted timestamp
- File logging: Optional file output alongside console logging
- Noise filtering: Pre-configured to suppress verbose logs from Bitcoin Core RPC and other dependencies
- Environment control: Respects
RUST_LOGenvironment variable for custom filtering
Usage
use log::info;
fn main() -> std::io::Result<()> {
// Initialize with console output only
brk_logger::init(None)?;
// Or initialize with file logging
brk_logger::init(Some(std::path::Path::new("app.log")))?;
info!("Application started");
Ok(())
}
Default Log Filtering
By default, the following crates are filtered to off to reduce noise:
bitcoin,bitcoincore-rpc- Bitcoin Core librariesfjall,lsm_tree- Storage engine logsrolldown,brk_rolldown- Bundler logsrmcp,brk_rmcp- MCP protocol logstracing- Tracing framework logs