Skip to content

Commit

Permalink
new: Add verbose log level. (#634)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Oct 10, 2024
1 parent 8cf0893 commit a7d69fa
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@

## Unreleased

#### 🚀 Updates

- Added a `--log verbose` level, which includes span information on top of the trace level.

#### 🐞 Fixes

- Fixed an issue where `--dump` can be interrupted.
Expand Down
10 changes: 9 additions & 1 deletion crates/cli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ pub enum LogLevel {
Info,
Debug,
Trace,
Verbose,
}

impl LogLevel {
pub fn is_verbose(&self) -> bool {
matches!(self, Self::Verbose)
}
}

impl Display for LogLevel {
Expand All @@ -36,7 +43,8 @@ impl Display for LogLevel {
LogLevel::Warn => "warn",
LogLevel::Info => "info",
LogLevel::Debug => "debug",
LogLevel::Trace => "trace",
// Must map to tracing levels
LogLevel::Trace | LogLevel::Verbose => "trace",
}
)?;

Expand Down
1 change: 1 addition & 0 deletions crates/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ async fn main() -> MainResult {
dump_trace: cli.dump && !matches!(cli.command, Commands::Run { .. }),
filter_modules: get_tracing_modules(),
log_env: "PROTO_APP_LOG".into(),
show_spans: cli.log.as_ref().is_some_and(|level| level.is_verbose()),
// test_env: "PROTO_TEST".into(),
..TracingOptions::default()
});
Expand Down

0 comments on commit a7d69fa

Please sign in to comment.