Skip to content

Commit

Permalink
Refactor "Log node-logs according to their level"
Browse files Browse the repository at this point in the history
  • Loading branch information
erdemyerebasmaz committed Mar 28, 2024
1 parent 5a3d835 commit 94788be
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions libs/sdk-core/src/breez_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1533,10 +1533,12 @@ impl BreezServices {
log_message_res = log_stream.message() => {
match log_message_res {
Ok(Some(l)) => {
match l.line.to_ascii_lowercase() {
s if s.starts_with("unusual") => error!("node-logs: {}", l.line.split_at(7).1.trim_start()),
s if s.starts_with("info") => info!("node-logs: {}", l.line.split_at(4).1.trim_start()),
s if s.starts_with("debug") => debug!("node-logs: {}", l.line.split_at(5).1.trim_start()),
let prefix_len = l.line.find(':').map_or(0, |len| len + 2);
let log_message = l.line.split_at(prefix_len).1.trim_start();
match l.line.to_ascii_lowercase().as_str() {
s if s.starts_with("unusual") => error!("node-logs: {}", log_message),
s if s.starts_with("info") => info!("node-logs: {}", log_message),
s if s.starts_with("debug") => debug!("node-logs: {}", log_message),
_ => trace!("node-logs: {}", l.line)
}
},
Expand Down

0 comments on commit 94788be

Please sign in to comment.