Skip to content

Commit

Permalink
chore: add more logs for #3839
Browse files Browse the repository at this point in the history
  • Loading branch information
dyc3 committed Sep 13, 2024
1 parent 2dd0e8b commit 606841d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/biome_service/src/file_handlers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self, FileSourceError> {
if let Ok(file_source) = JsonFileSource::try_from_well_known(path) {
return Ok(file_source.into());
Expand All @@ -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<Self, FileSourceError> {
if let Ok(file_source) = JsonFileSource::try_from_extension(extension) {
return Ok(file_source.into());
Expand All @@ -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<Self, FileSourceError> {
if let Ok(file_source) = JsonFileSource::try_from_language_id(language_id) {
return Ok(file_source.into());
Expand Down Expand Up @@ -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<Self, FileSourceError> {
if let Ok(file_source) = Self::try_from_well_known(path) {
return Ok(file_source);
Expand Down
2 changes: 2 additions & 0 deletions crates/biome_service/src/workspace/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DocumentFileSource> {
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);
Expand Down

0 comments on commit 606841d

Please sign in to comment.