Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Fix compilation error
Lorenz Leutgeb committed 7 months ago
commit 4b1b0054bea2c48c41a7abdf2fea97a9ef41feb4
parent 1dc4f2a3ab3fb0d9d1cc88f1750365467d5b0bbd
1 file changed +28 -27
modified crates/radicle-node/src/main.rs
@@ -219,38 +219,39 @@ fn initialize_logging(log_format: LogFormat) {
    type Error = Box<dyn std::error::Error>;

    let logger: Result<Option<Logger>, Error> = {
-
        #[cfg(all(feature = "systemd", target_os = "linux"))]
-
        {
-
            use thiserror::Error;
-

-
            #[derive(Error, Debug)]
-
            #[error("Error connecting to systemd journal: {0}")]
-
            struct JournalError(io::Error);
-

-
            radicle_systemd::journal::logger::<&str, &str, _>("radicle-node".to_string(), [])
-
                .map_err(|err| Box::new(JournalError(err)) as Error)
-
        }
-
        #[cfg(feature = "structured-logger")]
-
        {
-
            use structured_logger::{json, Builder};
+
        match log_format {
+
            #[cfg(feature = "structured-logger")]
+
            LogFormat::Json => {
+
                use structured_logger::{json, Builder};

-
            match log_format {
-
                LogFormat::Json => Ok(Some(Box::new(
+
                Ok(Some(Box::new(
                    Builder::new()
                        .with_default_writer(json::new_writer(io::stdout()))
                        .build(),
-
                ))),
-
                _ => Ok(None),
+
                )))
+
            }
+
            _ => {
+
                #[cfg(all(feature = "systemd", target_os = "linux"))]
+
                {
+
                    use thiserror::Error;
+

+
                    #[derive(Error, Debug)]
+
                    #[error("Error connecting to systemd journal: {0}")]
+
                    struct JournalError(io::Error);
+

+
                    radicle_systemd::journal::logger::<&str, &str, _>(
+
                        "radicle-node".to_string(),
+
                        [],
+
                    )
+
                    .map_err(|err| Box::new(JournalError(err)) as Error)
+
                }
+
                #[cfg(not(all(feature = "systemd", target_os = "linux")))]
+
                {
+
                    // This is constant, and `rustc` will hopefully use it to
+
                    // optimize away the `match` below.
+
                    Ok(None)
+
                }
            }
-
        }
-
        #[cfg(not(any(
-
            feature = "structured-logger",
-
            all(feature = "systemd", target_os = "linux")
-
        )))]
-
        {
-
            // This is constant, and `rustc` will hopefully use it to
-
            // optimize away the `match` below.
-
            Ok(None)
        }
    };