From 12688b65d8b810a5989158af288230d633b51b65 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Fri, 13 Sep 2024 12:21:09 -0400 Subject: [PATCH] chore: add more logs for #3839 (#3880) --- crates/biome_service/src/file_handlers/mod.rs | 8 ++++---- crates/biome_service/src/workspace/server.rs | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/biome_service/src/file_handlers/mod.rs b/crates/biome_service/src/file_handlers/mod.rs index e20c3b422d88..2da2abb62147 100644 --- a/crates/biome_service/src/file_handlers/mod.rs +++ b/crates/biome_service/src/file_handlers/mod.rs @@ -106,7 +106,7 @@ impl From<&Path> for DocumentFileSource { } impl DocumentFileSource { - #[instrument(level = "debug")] + #[instrument(level = "debug", fields(result))] fn try_from_well_known(path: &Path) -> Result { if let Ok(file_source) = JsonFileSource::try_from_well_known(path) { return Ok(file_source.into()); @@ -130,7 +130,7 @@ impl DocumentFileSource { .map_or(DocumentFileSource::Unknown, |file_source| file_source) } - #[instrument(level = "debug")] + #[instrument(level = "debug", fields(result))] fn try_from_extension(extension: &OsStr) -> Result { if let Ok(file_source) = JsonFileSource::try_from_extension(extension) { return Ok(file_source.into()); @@ -156,7 +156,7 @@ impl DocumentFileSource { .map_or(DocumentFileSource::Unknown, |file_source| file_source) } - #[instrument(level = "debug")] + #[instrument(level = "debug", fields(result))] fn try_from_language_id(language_id: &str) -> Result { if let Ok(file_source) = JsonFileSource::try_from_language_id(language_id) { return Ok(file_source.into()); @@ -187,7 +187,7 @@ impl DocumentFileSource { .map_or(DocumentFileSource::Unknown, |file_source| file_source) } - #[instrument(level = "debug")] + #[instrument(level = "debug", fields(result))] fn try_from_path(path: &Path) -> Result { if let Ok(file_source) = Self::try_from_well_known(path) { return Ok(file_source); diff --git a/crates/biome_service/src/workspace/server.rs b/crates/biome_service/src/workspace/server.rs index fa409085f581..b3f70d5fa443 100644 --- a/crates/biome_service/src/workspace/server.rs +++ b/crates/biome_service/src/workspace/server.rs @@ -151,11 +151,13 @@ impl WorkspaceServer { Ok(workspace.as_ref().get_current_manifest().cloned()) } + #[tracing::instrument(level = "trace", skip(self), fields(return))] fn get_source(&self, index: usize) -> Option { let file_sources = self.file_sources.read().unwrap(); file_sources.get_index(index).copied() } + #[tracing::instrument(level = "trace", skip(self), fields(return))] fn set_source(&self, document_file_source: DocumentFileSource) -> usize { let mut file_sources = self.file_sources.write().unwrap(); let (index, _) = file_sources.insert_full(document_file_source);