mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-25 23:30:59 +01:00
Implement error, warn, info, debug and trace macros, internally calling an instance of Logger, and passing it to every main structures Build-time or client-side filtering. Issue #54
23 lines
499 B
Rust
23 lines
499 B
Rust
use lightning::util::logger::{Logger, Level, Record};
|
|
|
|
pub struct TestLogger {
|
|
level: Level,
|
|
}
|
|
|
|
impl TestLogger {
|
|
pub fn new() -> TestLogger {
|
|
TestLogger {
|
|
level: Level::Off,
|
|
}
|
|
}
|
|
pub fn enable(&mut self, level: Level) {
|
|
self.level = level;
|
|
}
|
|
}
|
|
|
|
impl Logger for TestLogger {
|
|
fn log(&self, record: &Record) {
|
|
#[cfg(any(test, not(feature = "fuzztarget")))]
|
|
println!("{:<5} [{} : {}, {}] {}", record.level.to_string(), record.module_path, record.file, record.line, record.args);
|
|
}
|
|
}
|