Skip to content

Commit 38413d0

Browse files
author
Stephan Dilly
committed
consistent log:: usage
1 parent d8b5a4b commit 38413d0

File tree

7 files changed

+10
-24
lines changed

7 files changed

+10
-24
lines changed

asyncgit/src/diff.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::{
22
error::Result, hash, sync, AsyncNotification, FileDiff, CWD,
33
};
44
use crossbeam_channel::Sender;
5-
use log::trace;
65
use std::{
76
hash::Hash,
87
sync::{
@@ -72,7 +71,7 @@ impl AsyncDiff {
7271
&mut self,
7372
params: DiffParams,
7473
) -> Result<Option<FileDiff>> {
75-
trace!("request");
74+
log::trace!("request");
7675

7776
let hash = hash(&params);
7877

asyncgit/src/revlog.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use crate::{
55
};
66
use crossbeam_channel::Sender;
77
use git2::Oid;
8-
use log::debug;
98
use scopetime::scope_time;
109
use std::{
1110
iter::FromIterator,
@@ -89,11 +88,6 @@ impl AsyncLog {
8988
fn head_changed(&self) -> Result<bool> {
9089
if let Ok(head) = repo(CWD)?.head() {
9190
if let Some(head) = head.target() {
92-
debug!(
93-
"repo head vs current log head: {} vs. {}",
94-
head,
95-
self.current_head()?
96-
);
9791
return Ok(head != self.current_head()?);
9892
}
9993
}

asyncgit/src/status.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use crate::{
22
error::Result, hash, sync, AsyncNotification, StatusItem, CWD,
33
};
44
use crossbeam_channel::Sender;
5-
use log::trace;
65
use std::{
76
hash::Hash,
87
sync::{
@@ -86,7 +85,7 @@ impl AsyncStatus {
8685
) -> Result<Option<Status>> {
8786
let hash_request = hash(&params);
8887

89-
trace!("request: [hash: {}]", hash_request);
88+
log::trace!("request: [hash: {}]", hash_request);
9089

9190
{
9291
let mut current = self.current.lock()?;
@@ -135,7 +134,7 @@ impl AsyncStatus {
135134
arc_last: Arc<Mutex<Status>>,
136135
) -> Result<()> {
137136
let res = Self::get_status(status_type, include_untracked)?;
138-
trace!("status fetched: {}", hash(&res));
137+
log::trace!("status fetched: {}", hash(&res));
139138

140139
{
141140
let mut current = arc_current.lock()?;

asyncgit/src/sync/hunks.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use super::{
44
};
55
use crate::{error::Error, error::Result, hash};
66
use git2::{ApplyLocation, ApplyOptions, Diff};
7-
use log::error;
87
use scopetime::scope_time;
98

109
///
@@ -72,7 +71,6 @@ pub fn unstage_hunk(
7271
let hunk_index = find_hunk_index(&diff, hunk_hash);
7372

7473
if hunk_index.is_none() {
75-
error!("hunk not found");
7674
return Err(Error::Generic("hunk not found".to_string()));
7775
}
7876

@@ -100,7 +98,6 @@ pub fn unstage_hunk(
10098
.apply(&diff, ApplyLocation::Index, Some(&mut opt))
10199
.is_err()
102100
{
103-
error!("apply failed");
104101
return Err(Error::Generic("apply failed".to_string()));
105102
}
106103
}

scopetime/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#![forbid(missing_docs)]
55
#![deny(clippy::result_unwrap_used)]
66

7-
use log::trace;
87
use std::time::Instant;
98

109
///
@@ -37,7 +36,7 @@ impl<'a> ScopeTimeLog<'a> {
3736

3837
impl<'a> Drop for ScopeTimeLog<'a> {
3938
fn drop(&mut self) {
40-
trace!(
39+
log::trace!(
4140
"scopetime: {:?} ms [{}::{}] @{}:{}",
4241
self.time.elapsed().as_millis(),
4342
self.mod_path,

src/app.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use asyncgit::{sync, AsyncNotification, CWD};
1616
use crossbeam_channel::Sender;
1717
use crossterm::event::Event;
1818
use itertools::Itertools;
19-
use log::trace;
2019
use std::borrow::Cow;
2120
use strings::commands;
2221
use tui::{
@@ -113,7 +112,7 @@ impl App {
113112

114113
///
115114
pub fn event(&mut self, ev: Event) -> Result<()> {
116-
trace!("event: {:?}", ev);
115+
log::trace!("event: {:?}", ev);
117116

118117
if self.check_quit(ev) {
119118
return Ok(());
@@ -155,7 +154,7 @@ impl App {
155154
//TODO: do we need this?
156155
/// forward ticking to components that require it
157156
pub fn update(&mut self) -> Result<()> {
158-
trace!("update");
157+
log::trace!("update");
159158
self.status_tab.update()?;
160159
self.revlog.update()?;
161160
self.stashing_tab.update()?;
@@ -168,7 +167,7 @@ impl App {
168167
&mut self,
169168
ev: AsyncNotification,
170169
) -> Result<()> {
171-
trace!("update_git: {:?}", ev);
170+
log::trace!("update_git: {:?}", ev);
172171

173172
self.status_tab.update_git(ev)?;
174173
self.stashing_tab.update_git(ev)?;

src/components/commit.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::{
1010
use anyhow::Result;
1111
use asyncgit::{sync, CWD};
1212
use crossterm::event::{Event, KeyCode};
13-
use log::error;
1413
use strings::commands;
1514
use sync::HookResult;
1615
use tui::{backend::Backend, layout::Rect, Frame};
@@ -104,7 +103,7 @@ impl CommitComponent {
104103
if let HookResult::NotOk(e) =
105104
sync::hooks_commit_msg(CWD, &mut msg)?
106105
{
107-
error!("commit-msg hook error: {}", e);
106+
log::error!("commit-msg hook error: {}", e);
108107
self.queue.borrow_mut().push_back(
109108
InternalEvent::ShowErrorMsg(format!(
110109
"commit-msg hook error:\n{}",
@@ -115,7 +114,7 @@ impl CommitComponent {
115114
}
116115

117116
if let Err(e) = sync::commit(CWD, &msg) {
118-
error!("commit error: {}", &e);
117+
log::error!("commit error: {}", &e);
119118
self.queue.borrow_mut().push_back(
120119
InternalEvent::ShowErrorMsg(format!(
121120
"commit failed:\n{}",
@@ -126,7 +125,7 @@ impl CommitComponent {
126125
}
127126

128127
if let HookResult::NotOk(e) = sync::hooks_post_commit(CWD)? {
129-
error!("post-commit hook error: {}", e);
128+
log::error!("post-commit hook error: {}", e);
130129
self.queue.borrow_mut().push_back(
131130
InternalEvent::ShowErrorMsg(format!(
132131
"post-commit hook error:\n{}",

0 commit comments

Comments
 (0)