Take the logger from test_utils into fuzz::test_utils
[rust-lightning] / fuzz / fuzz_targets / utils / test_logger.rs
index f828d0638f17726690c2c9b83807866c634287bd..097d001dbb25f80e0049a6c1526c379365a0f49f 100644 (file)
@@ -1,11 +1,22 @@
 use lightning::util::logger::{Logger, Record};
+pub struct TestLogger {
+       #[cfg(test)]
+       id: String,
+}
 
-pub struct TestLogger {}
+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(), record.module_path, record.file, record.line, record.args);
+               println!("{:<5} {} [{} : {}, {}] {}", record.level.to_string(), self.id, record.module_path, record.file, record.line, record.args);
                #[cfg(not(test))]
                let _ = format!("{}", record.args);
        }