X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=fuzz%2Ffuzz_targets%2Futils%2Ftest_logger.rs;h=097d001dbb25f80e0049a6c1526c379365a0f49f;hb=ab8f5a8620760eaac3d5a150d06e35ac88ae1ea1;hp=2ef1196b586af79c82cde6b787098302997de38e;hpb=03c6f84aa82e04c20692f01303bb9eaf6fde4411;p=rust-lightning diff --git a/fuzz/fuzz_targets/utils/test_logger.rs b/fuzz/fuzz_targets/utils/test_logger.rs index 2ef1196b..097d001d 100644 --- a/fuzz/fuzz_targets/utils/test_logger.rs +++ b/fuzz/fuzz_targets/utils/test_logger.rs @@ -1,10 +1,23 @@ 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(any(test, not(feature = "fuzztarget")))] - println!("{:<5} [{} : {}, {}] {}", record.level.to_string(), record.module_path, record.file, record.line, record.args); + #[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); } }