Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
node/log: Warn about useless `--log-format` args
◌ CI pending Lorenz Leutgeb committed 7 months ago
commit 7110f9c0d6307c7a7030a8d88225ade54b326452
parent 13525d2da62a7e759c686a3e255a3feef0229df3
2 pending (2 total) View logs
1 file changed +15 -0
modified crates/radicle-node/src/main.rs
@@ -296,6 +296,21 @@ fn initialize_logging(options: &LogOptions) -> Result<(), Box<dyn std::error::Er
    log::set_boxed_logger(logger).expect("no other logger should have been set already");
    log::set_max_level(level.to_level_filter());

+
    // Now that we have a logger, and since this `fn` is the place to
+
    // interpret [`LogOptions`], warn about these options as appropriate.
+
    match (&options.logger, &options.format) {
+
        (_, None) => {
+
            // `--log-format` was not passed.
+
        }
+
        #[cfg(feature = "structured-logger")]
+
        (Logger::Structured, Some(LogFormat::Json)) => {
+
            // This logger consumes and interprets the format.
+
        }
+
        (_, Some(_)) => {
+
            log::warn!("Option `--log-format` has no effect on this logger.")
+
        }
+
    }
+

    Ok(())
}