Skip to content

Commit

Permalink
LS: Filter out less important Salsa logs from trace profiles (#6516)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkaput authored and integraledelebesgue committed Oct 25, 2024
1 parent f55254f commit 6ff6054
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion crates/cairo-lang-language-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fn init_logging() -> Option<impl Drop> {
use std::io::IsTerminal;

use tracing_chrome::ChromeLayerBuilder;
use tracing_subscriber::filter::{EnvFilter, LevelFilter};
use tracing_subscriber::filter::{EnvFilter, LevelFilter, Targets};
use tracing_subscriber::fmt::Layer;
use tracing_subscriber::fmt::time::Uptime;
use tracing_subscriber::prelude::*;
Expand Down Expand Up @@ -192,6 +192,12 @@ fn init_logging() -> Option<impl Drop> {
let (profile_layer, profile_layer_guard) =
ChromeLayerBuilder::new().writer(profile_file).include_args(true).build();

// Filter out less important Salsa logs because they are too verbose,
// and with them the profile file quickly grows to several GBs of data.
let profile_layer = profile_layer.with_filter(
Targets::new().with_default(LevelFilter::TRACE).with_target("salsa", LevelFilter::WARN),
);

guard = Some(profile_layer_guard);
Some(profile_layer)
} else {
Expand Down

0 comments on commit 6ff6054

Please sign in to comment.