mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
rm env_logger; use tracing instead
This commit is contained in:
parent
196872b109
commit
e2c4b2b67e
6 changed files with 14 additions and 29 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -260,16 +260,6 @@ version = "1.6.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
|
||||
|
||||
[[package]]
|
||||
name = "env_logger"
|
||||
version = "0.10.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
|
||||
dependencies = [
|
||||
"humantime",
|
||||
"log",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "errno"
|
||||
version = "0.3.0"
|
||||
|
@ -354,12 +344,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "2.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
|
||||
|
||||
[[package]]
|
||||
name = "indexmap"
|
||||
version = "1.9.3"
|
||||
|
@ -472,10 +456,8 @@ dependencies = [
|
|||
"dns_common",
|
||||
"dns_common_derive",
|
||||
"edit",
|
||||
"env_logger",
|
||||
"etcetera",
|
||||
"lazy_static",
|
||||
"log",
|
||||
"regex",
|
||||
"remove_dir_all 0.8.2",
|
||||
"serde",
|
||||
|
|
|
@ -36,8 +36,6 @@ serde_yaml = "0.9.21"
|
|||
dns_common_derive = { version = "0.2.1" }
|
||||
dns_common = { version = "0.2.1", default-features = false, features = ["yaml", "json"] }
|
||||
unicode-width = "0.1.10"
|
||||
log = "0.4"
|
||||
env_logger = { version = "0.10", default_features = false, features = ["humantime"] }
|
||||
|
||||
[lib]
|
||||
name = "navi"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
extern crate navi;
|
||||
|
||||
use dns_common::prelude::{debug, error, tracing, tracing_subscriber};
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
@ -26,16 +27,20 @@ impl FileAnIssue {
|
|||
fn main() -> Result<(), anyhow::Error> {
|
||||
init_logger()?;
|
||||
navi::handle().map_err(|e| {
|
||||
log::error!("{e:?}");
|
||||
error!("{e:?}");
|
||||
FileAnIssue::new(e).into()
|
||||
})
|
||||
}
|
||||
|
||||
fn init_logger() -> anyhow::Result<()> {
|
||||
let file = std::fs::File::create("navi.log")?;
|
||||
env_logger::builder()
|
||||
.target(env_logger::Target::Pipe(Box::new(file)))
|
||||
.init();
|
||||
|
||||
tracing::subscriber::set_global_default(
|
||||
tracing_subscriber::fmt()
|
||||
.with_ansi(false)
|
||||
// TODO: config_path/navi.log
|
||||
.with_writer(std::fs::File::create("navi.log")?)
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.finish(),
|
||||
)?;
|
||||
debug!("tracing initialized");
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ pub fn init(fetcher: Box<dyn Fetcher>) -> Result<()> {
|
|||
|
||||
pub fn get_fetcher() -> Result<Box<dyn Fetcher>> {
|
||||
let source = CONFIG.source();
|
||||
log::debug!("{source:#?}");
|
||||
debug!("{source:#?}");
|
||||
match source {
|
||||
Source::Cheats(query) => {
|
||||
let lines = cheatsh::call(&query)?;
|
||||
|
|
|
@ -12,7 +12,7 @@ use crate::prelude::*;
|
|||
pub fn handle() -> Result<()> {
|
||||
use crate::config::Command::*;
|
||||
|
||||
log::debug!("CONFIG = {:#?}", &*CONFIG);
|
||||
debug!("CONFIG = {:#?}", &*CONFIG);
|
||||
match CONFIG.cmd() {
|
||||
None => commands::core::main(),
|
||||
|
||||
|
|
|
@ -181,7 +181,7 @@ impl fetcher::Fetcher for Fetcher {
|
|||
}
|
||||
}
|
||||
|
||||
log::debug!("filesystem::Fetcher = {self:#?}");
|
||||
debug!("filesystem::Fetcher = {self:#?}");
|
||||
Ok(found_something)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue