Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ignore span logs below WARN #958

Merged
merged 7 commits into from
Jun 2, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Ignore span logs below WARN
  • Loading branch information
jonaro00 committed May 31, 2023
commit b13a24790a6b67975c8bdae39db857d1b40c9c9c
10 changes: 9 additions & 1 deletion runtime/src/logger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,16 @@ where
format!("[span] {}", metadata.name()).into(),
);

let level = LogLevel::from(metadata.level()) as i32;

// Ignore span logs from the default level for #[instrument] (INFO) and below.
// TODO: make this configurable
if level < LogLevel::Warn as i32 {
return;
}

LogItem {
level: LogLevel::from(metadata.level()) as i32,
level,
timestamp: Some(Timestamp::from(SystemTime::from(datetime))),
file: visitor.file.or_else(|| metadata.file().map(str::to_string)),
line: visitor.line.or_else(|| metadata.line()),
Expand Down