use ln::msgs;
use ln::msgs::{HandleError};
use util::events;
+use util::logger::{Logger, Level, Record};
use bitcoin::blockdata::transaction::Transaction;
Err(HandleError { err: "", action: None })
}
fn peer_disconnected(&self, _their_node_id: &PublicKey, _no_connection_possible: bool) {}
+ fn handle_error(&self, _their_node_id: &PublicKey, _msg: &msgs::ErrorMessage) {}
}
impl events::EventsProvider for TestChannelMessageHandler {
}
fn handle_htlc_fail_channel_update(&self, _update: &msgs::HTLCFailChannelUpdate) {}
}
+
+pub struct TestLogger {
+ level: Level,
+}
+
+impl TestLogger {
+ pub fn new() -> TestLogger {
+ TestLogger {
+ level: Level::Trace,
+ }
+ }
+ pub fn enable(&mut self, level: Level) {
+ self.level = level;
+ }
+}
+
+impl Logger for TestLogger {
+ fn log(&self, record: &Record) {
+ if self.level >= record.level {
+ println!("{:<5} [{} : {}, {}] {}", record.level.to_string(), record.module_path, record.file, record.line, record.args);
+ }
+ }
+}