fix: formatting

This commit is contained in:
Roman 2024-12-06 22:29:26 +08:00
parent f7465746f0
commit 8065685e35
No known key found for this signature in database
GPG Key ID: B8FE070B54E11B75
2 changed files with 12 additions and 24 deletions

View File

@ -1,14 +1,14 @@
use clap::{Parser, ValueEnum};
use color_eyre::eyre::{eyre, Result};
use serde::{Deserialize, Serialize};
use std::net::ToSocketAddrs;
use std::path::PathBuf;
use clap::{Parser, ValueEnum};
use serde::{Deserialize, Serialize};
use color_eyre::eyre::{eyre, Result};
use tracing::Level;
use nomos_tracing_service::{LoggerLayer, Tracing};
use overwatch_rs::services::ServiceData;
use nomos_tracing::logging::gelf::GelfConfig;
use nomos_tracing::logging::local::FileConfig;
use nomos_tracing_service::{LoggerLayer, Tracing};
use overwatch_rs::services::ServiceData;
#[derive(ValueEnum, Clone, Debug, Default)]
pub enum LoggerLayerType {
@ -19,7 +19,6 @@ pub enum LoggerLayerType {
Stderr,
}
#[derive(Parser, Debug, Clone)]
pub struct LogArgs {
/// Address for the Gelf backend
@ -48,10 +47,7 @@ pub struct Config {
}
impl Config {
pub fn update_from_args(
mut self,
log_args: LogArgs,
) -> Result<Self> {
pub fn update_from_args(mut self, log_args: LogArgs) -> Result<Self> {
update_tracing(&mut self.tracing, log_args)?;
Ok(self)
}
@ -98,4 +94,4 @@ pub fn update_tracing(
};
}
Ok(())
}
}

View File

@ -1,8 +1,8 @@
mod config;
use clap::Parser;
use crate::config::{Config, LogArgs};
use color_eyre::eyre::{Result};
use clap::Parser;
use color_eyre::eyre::Result;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
@ -14,21 +14,13 @@ struct Args {
log_args: LogArgs,
}
fn main() -> Result<()> {
// Parse cluster options
let Args {
config,
log_args,
} = Args::parse();
let config = serde_yaml::from_reader::<_, Config>(std::fs::File::open(config)?)?
.update_from_args(
log_args,
)?;
let Args { config, log_args } = Args::parse();
let _config = serde_yaml::from_reader::<_, Config>(std::fs::File::open(config)?)?
.update_from_args(log_args)?;
// Run the test suite
Ok(())
}