From 00fee9fa935fec0235467df8d58905fe757b9b8a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Fri, 10 Jan 2025 23:47:12 +0000 Subject: [PATCH] Disable `Gossip`-level logging at runtime This used to be disabled at compile-time, but the feature was removed as it didn't net substantial performance gain, so now we disable them at runtime. --- src/disk.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/disk.rs b/src/disk.rs index 62d77c6..00f0ea4 100644 --- a/src/disk.rs +++ b/src/disk.rs @@ -4,7 +4,7 @@ use bitcoin::Network; use chrono::Utc; use lightning::routing::scoring::{ProbabilisticScorer, ProbabilisticScoringDecayParameters}; use lightning::util::hash_tables::{new_hash_map, HashMap}; -use lightning::util::logger::{Logger, Record}; +use lightning::util::logger::{Level, Logger, Record}; use lightning::util::ser::{Readable, ReadableArgs}; use std::fs; use std::fs::File; @@ -28,6 +28,10 @@ impl FilesystemLogger { } impl Logger for FilesystemLogger { fn log(&self, record: Record) { + if record.level == Level::Gossip { + // Gossip-level logs are incredibly verbose, and thus we skip them by default. + return; + } let raw_log = record.args.to_string(); let log = format!( "{} {:<5} [{}:{}] {}\n",