Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Baschtie committed Sep 10, 2023
1 parent f196c32 commit 6a991aa
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ pub struct Cli {
pub command: Commands,
#[clap(
long,
default_value_t = LogFormats::Detect,
value_parser = clap::builder::PossibleValuesParser::new(["detect", "json", "pretty", "ppretty"])
default_value_t = LogFormats::Auto,
value_parser = clap::builder::PossibleValuesParser::new(["auto", "json", "plain", "pretty"])
.map(|s| s.parse::<LogFormats>().unwrap()),
)]
pub log_format: LogFormats,
Expand All @@ -82,15 +82,15 @@ pub struct Cli {
/// The various log format options
#[derive(Copy, Clone, PartialEq, Eq, Debug, EnumString, Display, Default)]
pub enum LogFormats {
#[strum(serialize = "detect")]
#[strum(serialize = "auto")]
#[default]
Detect,
Auto,
#[strum(serialize = "json")]
Json,
#[strum(serialize = "plain")]
Plain,
#[strum(serialize = "pretty")]
Pretty,
#[strum(serialize = "ppretty")]
PrettyPretty,
}

/// The various Quilkin commands.
Expand Down Expand Up @@ -129,16 +129,16 @@ impl Cli {
.with_env_filter(env_filter);

match self.log_format {
LogFormats::Detect => {
LogFormats::Auto => {
if atty::isnt(atty::Stream::Stdout) {
subscriber.json().init();
} else {
subscriber.init();
}
}
LogFormats::Json => subscriber.json().init(),
LogFormats::Pretty => subscriber.init(),
LogFormats::PrettyPretty => subscriber.pretty().init(),
LogFormats::Plain => subscriber.init(),
LogFormats::Pretty => subscriber.pretty().init(),
}
}

Expand Down

0 comments on commit 6a991aa

Please sign in to comment.