Skip to content

Commit

Permalink
switch to tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kl4rry committed Mar 9, 2024
1 parent ea0ff53 commit 567226b
Show file tree
Hide file tree
Showing 13 changed files with 169 additions and 126 deletions.
174 changes: 99 additions & 75 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ humansize = "2.1.3"
ignore = "0.4.20"
include_dir = { version = "0.7.3", optional = true }
lexical-sort = "0.3.1"
log = "0.4.17"
memchr = "2.5.0"
notify = "6.0.0"
once_cell = "1.17.1"
rayon = "1.7.0"
ropey = "1.5.1"
serde = { version = "1.0.152", features = ["derive"] }
simplelog = "0.12.0"
slab = "0.4.8"
sublime_fuzzy = "0.7.0"
toml = "0.7.1"
tracing = "0.1.40"
tracing-log = "0.2.0"
tracing-subscriber = "0.3.18"
tree-sitter = "0.20.10"
tree_magic_mini = { version = "3.0.3", features = ["with-gpl-data"] }
tui = { package = "ratatui", version = "0.23.0" }
Expand Down
2 changes: 1 addition & 1 deletion src/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn set_primary(text: impl Into<String>) {
let _ = clipboard
.set()
.clipboard(LinuxClipboardKind::Primary)
.text(&text.into());
.text(text.into());
}
}

Expand Down
11 changes: 6 additions & 5 deletions src/ferrite_core/buffer.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use core::fmt;
use std::{
cmp, io,
num::NonZeroUsize,
Expand Down Expand Up @@ -98,9 +99,9 @@ impl Default for Buffer {
}
}

impl ToString for Buffer {
fn to_string(&self) -> String {
self.rope.to_string()
impl fmt::Display for Buffer {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", self.rope)
}
}

Expand All @@ -123,7 +124,7 @@ impl Buffer {
let mut syntax = Syntax::new(proxy);
if let Some(language) = get_language_from_path(&path) {
if let Err(err) = syntax.set_language(language) {
log::error!("Error setting language: {err}");
tracing::error!("Error setting language: {err}");
}
syntax.update_text(Rope::new());
}
Expand All @@ -142,7 +143,7 @@ impl Buffer {
let mut syntax = Syntax::new(proxy);
if let Some(language) = get_language_from_path(path) {
if let Err(err) = syntax.set_language(language) {
log::error!("Error setting language: {err}");
tracing::error!("Error setting language: {err}");
}
syntax.update_text(rope.clone());
}
Expand Down
2 changes: 1 addition & 1 deletion src/ferrite_core/buffer/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl History {
frame.edits.push(inverse);
}
}
None => log::error!("Edited rope before starting new edit frame"),
None => tracing::error!("Edited rope before starting new edit frame"),
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/ferrite_core/buffer/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl BufferSearcher {

let thread_matches = matches.clone();
thread::spawn(move || {
log::info!("search thread spawned");
tracing::info!("search thread spawned");
let matches = thread_matches;
let mut query = query;
let mut rope = thread_rope;
Expand Down Expand Up @@ -97,7 +97,7 @@ impl BufferSearcher {
proxy.request_render();
match_buffer.clear();
}
log::info!("search thread exit");
tracing::info!("search thread exit");
});

Self {
Expand Down
6 changes: 4 additions & 2 deletions src/ferrite_core/git/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fn get_current_branch() -> Option<String> {
}
}
Err(err) => {
log::error!("{}", err);
tracing::error!("{}", err);
None
}
}
Expand Down Expand Up @@ -52,7 +52,9 @@ impl BranchWatcher {
let mut guard = current_branch_thread.lock().unwrap();
if let Some(current) = &*guard {
if current != &branch {
log::info!("Git branch changed from `{current}` to `{branch}`");
tracing::info!(
"Git branch changed from `{current}` to `{branch}`"
);
}
}
*guard = Some(branch);
Expand Down
Loading

0 comments on commit 567226b

Please sign in to comment.