consistent log:: usage

This commit is contained in:
Stephan Dilly 2020-05-23 23:31:15 +02:00
parent d8b5a4b2c5
commit 38413d069e
7 changed files with 10 additions and 24 deletions

View File

@ -2,7 +2,6 @@ use crate::{
error::Result, hash, sync, AsyncNotification, FileDiff, CWD,
};
use crossbeam_channel::Sender;
use log::trace;
use std::{
hash::Hash,
sync::{
@ -72,7 +71,7 @@ impl AsyncDiff {
&mut self,
params: DiffParams,
) -> Result<Option<FileDiff>> {
trace!("request");
log::trace!("request");
let hash = hash(&params);

View File

@ -5,7 +5,6 @@ use crate::{
};
use crossbeam_channel::Sender;
use git2::Oid;
use log::debug;
use scopetime::scope_time;
use std::{
iter::FromIterator,
@ -89,11 +88,6 @@ impl AsyncLog {
fn head_changed(&self) -> Result<bool> {
if let Ok(head) = repo(CWD)?.head() {
if let Some(head) = head.target() {
debug!(
"repo head vs current log head: {} vs. {}",
head,
self.current_head()?
);
return Ok(head != self.current_head()?);
}
}

View File

@ -2,7 +2,6 @@ use crate::{
error::Result, hash, sync, AsyncNotification, StatusItem, CWD,
};
use crossbeam_channel::Sender;
use log::trace;
use std::{
hash::Hash,
sync::{
@ -86,7 +85,7 @@ impl AsyncStatus {
) -> Result<Option<Status>> {
let hash_request = hash(&params);
trace!("request: [hash: {}]", hash_request);
log::trace!("request: [hash: {}]", hash_request);
{
let mut current = self.current.lock()?;
@ -135,7 +134,7 @@ impl AsyncStatus {
arc_last: Arc<Mutex<Status>>,
) -> Result<()> {
let res = Self::get_status(status_type, include_untracked)?;
trace!("status fetched: {}", hash(&res));
log::trace!("status fetched: {}", hash(&res));
{
let mut current = arc_current.lock()?;

View File

@ -4,7 +4,6 @@ use super::{
};
use crate::{error::Error, error::Result, hash};
use git2::{ApplyLocation, ApplyOptions, Diff};
use log::error;
use scopetime::scope_time;
///
@ -72,7 +71,6 @@ pub fn unstage_hunk(
let hunk_index = find_hunk_index(&diff, hunk_hash);
if hunk_index.is_none() {
error!("hunk not found");
return Err(Error::Generic("hunk not found".to_string()));
}
@ -100,7 +98,6 @@ pub fn unstage_hunk(
.apply(&diff, ApplyLocation::Index, Some(&mut opt))
.is_err()
{
error!("apply failed");
return Err(Error::Generic("apply failed".to_string()));
}
}

View File

@ -4,7 +4,6 @@
#![forbid(missing_docs)]
#![deny(clippy::result_unwrap_used)]
use log::trace;
use std::time::Instant;
///
@ -37,7 +36,7 @@ impl<'a> ScopeTimeLog<'a> {
impl<'a> Drop for ScopeTimeLog<'a> {
fn drop(&mut self) {
trace!(
log::trace!(
"scopetime: {:?} ms [{}::{}] @{}:{}",
self.time.elapsed().as_millis(),
self.mod_path,

View File

@ -16,7 +16,6 @@ use asyncgit::{sync, AsyncNotification, CWD};
use crossbeam_channel::Sender;
use crossterm::event::Event;
use itertools::Itertools;
use log::trace;
use std::borrow::Cow;
use strings::commands;
use tui::{
@ -113,7 +112,7 @@ impl App {
///
pub fn event(&mut self, ev: Event) -> Result<()> {
trace!("event: {:?}", ev);
log::trace!("event: {:?}", ev);
if self.check_quit(ev) {
return Ok(());
@ -155,7 +154,7 @@ impl App {
//TODO: do we need this?
/// forward ticking to components that require it
pub fn update(&mut self) -> Result<()> {
trace!("update");
log::trace!("update");
self.status_tab.update()?;
self.revlog.update()?;
self.stashing_tab.update()?;
@ -168,7 +167,7 @@ impl App {
&mut self,
ev: AsyncNotification,
) -> Result<()> {
trace!("update_git: {:?}", ev);
log::trace!("update_git: {:?}", ev);
self.status_tab.update_git(ev)?;
self.stashing_tab.update_git(ev)?;

View File

@ -10,7 +10,6 @@ use crate::{
use anyhow::Result;
use asyncgit::{sync, CWD};
use crossterm::event::{Event, KeyCode};
use log::error;
use strings::commands;
use sync::HookResult;
use tui::{backend::Backend, layout::Rect, Frame};
@ -104,7 +103,7 @@ impl CommitComponent {
if let HookResult::NotOk(e) =
sync::hooks_commit_msg(CWD, &mut msg)?
{
error!("commit-msg hook error: {}", e);
log::error!("commit-msg hook error: {}", e);
self.queue.borrow_mut().push_back(
InternalEvent::ShowErrorMsg(format!(
"commit-msg hook error:\n{}",
@ -115,7 +114,7 @@ impl CommitComponent {
}
if let Err(e) = sync::commit(CWD, &msg) {
error!("commit error: {}", &e);
log::error!("commit error: {}", &e);
self.queue.borrow_mut().push_back(
InternalEvent::ShowErrorMsg(format!(
"commit failed:\n{}",
@ -126,7 +125,7 @@ impl CommitComponent {
}
if let HookResult::NotOk(e) = sync::hooks_post_commit(CWD)? {
error!("post-commit hook error: {}", e);
log::error!("post-commit hook error: {}", e);
self.queue.borrow_mut().push_back(
InternalEvent::ShowErrorMsg(format!(
"post-commit hook error:\n{}",