// SPDX-License-Identifier: AGPL-3.0-or-later use chrono; use env_logger; use std::io::Write; pub trait BuilderExt { /// Uses a standard format for log messages which includes the source file and line number /// a logging statement occurred on. fn btformat(&mut self) -> &mut Self; } impl BuilderExt for env_logger::Builder { fn btformat(&mut self) -> &mut Self { self.format(|fmt, record| { writeln!( fmt, "[{} {} {}:{}] {}", chrono::Utc::now().to_rfc3339(), record.level(), record.file().unwrap_or("(unknown)"), record.line().unwrap_or(u32::MAX), record.args(), ) }) } }