mirror of
https://github.com/lightningdevkit/rust-lightning.git
synced 2025-02-26 15:42:52 +01:00
23 lines
488 B
Rust
23 lines
488 B
Rust
use lightning::util::logger::{Logger, Record};
|
|
pub struct TestLogger {
|
|
#[cfg(test)]
|
|
id: String,
|
|
}
|
|
|
|
impl TestLogger {
|
|
pub fn new(_id: String) -> TestLogger {
|
|
TestLogger {
|
|
#[cfg(test)]
|
|
id: _id
|
|
}
|
|
}
|
|
}
|
|
|
|
impl Logger for TestLogger {
|
|
fn log(&self, record: &Record) {
|
|
#[cfg(test)]
|
|
println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
|
|
#[cfg(not(test))]
|
|
let _ = format!("{}", record.args);
|
|
}
|
|
}
|