Now using tracing instead of log.

This commit is contained in:
Filipe Rodrigues 2022-08-17 02:00:55 +01:00
parent c442328ae5
commit 3ec470087d
No known key found for this signature in database
GPG Key ID: A0E31C6EE7CB70F0
8 changed files with 17 additions and 24 deletions

View File

@ -18,7 +18,7 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
thiserror = "1.0.32"
# Logging
log = "0.4.17"
tracing = "0.1.36"
# Serde
serde = {version = "1.0.143", features = ["derive"]}

View File

@ -17,7 +17,7 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
thiserror = "1.0.32"
# Logging
log = "0.4.17"
tracing = "0.1.36"
# Serde
serde = {version = "1.0.143", features = ["derive"]}

View File

@ -21,7 +21,7 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
thiserror = "1.0.32"
# Logging
log = "0.4.17"
tracing = "0.1.36"
# Serde
serde = {version = "1.0.143", features = ["derive"]}

View File

@ -17,7 +17,7 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
thiserror = "1.0.28"
# Logging
log = "0.4.14"
tracing = "0.1.36"
# Serde
serde = {version = "1.0.130", features = ["derive"]}

View File

@ -21,8 +21,8 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
anyhow = "1.0.62"
# Logging
log = "0.4.17"
simplelog = "0.12.0"
tracing = "0.1.36"
tracing-subscriber = {version = "0.3.15", features = ["env-filter"]}
# Serde
serde_yaml = "0.9.9"

View File

@ -13,18 +13,15 @@ use clap::Parser;
use ndsz_fat::{dir, Dir, FileAllocationTable};
use ndsz_narc::Narc;
use std::{fs, io, path::PathBuf};
use tracing_subscriber::prelude::*;
use zutil::{AsciiStrArr, IoSlice};
fn main() -> Result<(), anyhow::Error> {
// Initialize the logger
simplelog::TermLogger::init(
log::LevelFilter::Debug,
simplelog::Config::default(),
simplelog::TerminalMode::Stderr,
simplelog::ColorChoice::Auto,
)
.context("Unable to initialize logger")?;
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_filter(tracing_subscriber::EnvFilter::from_default_env()))
.init();
// Get the arguments
let args = Args::parse();

View File

@ -21,8 +21,8 @@ zutil = {git = "https://github.com/Zenithsiz/zutil", rev = "2a029369ac5aa4e7dbd6
anyhow = "1.0.62"
# Logging
log = "0.4.17"
simplelog = "0.12.0"
tracing = "0.1.36"
tracing-subscriber = {version = "0.3.15", features = ["env-filter"]}
# Serde
serde_yaml = "0.9.9"

View File

@ -15,18 +15,15 @@ use std::{
fs, io,
path::{Path, PathBuf},
};
use tracing_subscriber::prelude::*;
use zutil::{AsciiStrArr, IoSlice, ReadByteArray};
fn main() -> Result<(), anyhow::Error> {
// Initialize the logger
simplelog::TermLogger::init(
log::LevelFilter::Debug,
simplelog::Config::default(),
simplelog::TerminalMode::Stderr,
simplelog::ColorChoice::Auto,
)
.context("Unable to initialize logger")?;
tracing_subscriber::registry()
.with(tracing_subscriber::fmt::layer().with_filter(tracing_subscriber::EnvFilter::from_default_env()))
.init();
// Get the arguments
let args = Args::parse();
@ -39,8 +36,7 @@ fn main() -> Result<(), anyhow::Error> {
let header_bytes = input_file.read_byte_array().context("Unable to read header")?;
ndsz_nds::Header::from_bytes(&header_bytes).context("Unable to parse header")?
};
log::info!("Found header {header:#?}");
tracing::trace!(?header);
// Get the fat
let fat = {