mirror of
https://github.com/denisidoro/navi
synced 2024-11-22 03:23:05 +00:00
mv navi.log under config dir; debug folders on Windows
2023-05-12T15:51:54.280707Z DEBUG navi::filesystem: read cheat files in `"C"`: [] 2023-05-12T15:51:54.281083Z DEBUG navi::filesystem: read cheat files in `"\\Users\\Administrator\\AppData\\Roaming\\navi\\cheats"`: []
This commit is contained in:
parent
818d5cdc0e
commit
2755d51b38
3 changed files with 12 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
extern crate navi;
|
||||
|
||||
use dns_common::prelude::{debug, error, tracing, tracing_subscriber};
|
||||
use dns_common::prelude::*;
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
|
@ -33,14 +33,18 @@ fn main() -> Result<(), anyhow::Error> {
|
|||
}
|
||||
|
||||
fn init_logger() -> anyhow::Result<()> {
|
||||
const FILE_NAME: &str = "navi.log";
|
||||
let mut file = navi::default_config_pathbuf()?;
|
||||
file.set_file_name(FILE_NAME);
|
||||
|
||||
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_writer(std::fs::File::create(file)?)
|
||||
.with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
|
||||
.finish(),
|
||||
)?;
|
||||
debug!("tracing initialized");
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -166,7 +166,9 @@ impl fetcher::Fetcher for Fetcher {
|
|||
None => folder.to_string(),
|
||||
};
|
||||
let folder_pathbuf = PathBuf::from(interpolated_folder);
|
||||
for file in all_cheat_files(&folder_pathbuf) {
|
||||
let cheat_files = all_cheat_files(&folder_pathbuf);
|
||||
debug!("read cheat files in `{folder_pathbuf:?}`: {cheat_files:#?}");
|
||||
for file in cheat_files {
|
||||
self.files.borrow_mut().push(file.clone());
|
||||
let index = self.files.borrow().len() - 1;
|
||||
let read_file_result = {
|
||||
|
@ -181,7 +183,7 @@ impl fetcher::Fetcher for Fetcher {
|
|||
}
|
||||
}
|
||||
|
||||
debug!("filesystem::Fetcher = {self:#?}");
|
||||
debug!("{self:#?}");
|
||||
Ok(found_something)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,4 +14,4 @@ mod prelude;
|
|||
mod structures;
|
||||
mod welcome;
|
||||
|
||||
pub use commands::handle;
|
||||
pub use {commands::handle, filesystem::default_config_pathbuf};
|
||||
|
|
Loading…
Reference in a new issue