add logging crate to reduce unnecessary stdout spam
This commit is contained in:
parent
3023576fec
commit
1e5d328ab4
4 changed files with 22 additions and 2 deletions
|
|
@ -3,11 +3,17 @@ name = "entomologist"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
log = ["dep:log", "dep:simple_logger"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.95"
|
anyhow = "1.0.95"
|
||||||
clap = { version = "4.5.26", features = ["derive"] }
|
clap = { version = "4.5.26", features = ["derive"] }
|
||||||
|
log = { version = "0.4.27", optional = true }
|
||||||
rand = "0.9.1"
|
rand = "0.9.1"
|
||||||
serde = { version = "1.0.217", features = ["derive"] }
|
serde = { version = "1.0.217", features = ["derive"] }
|
||||||
|
simple_logger = { version = "5.0.0", optional = true }
|
||||||
tempfile = "3.20.0"
|
tempfile = "3.20.0"
|
||||||
thiserror = "2.0.11"
|
thiserror = "2.0.11"
|
||||||
toml = "0.8.19"
|
toml = "0.8.19"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
|
#[cfg(feature = "log")]
|
||||||
|
use simple_logger;
|
||||||
|
|
||||||
#[derive(Debug, clap::Parser)]
|
#[derive(Debug, clap::Parser)]
|
||||||
#[command(version, about, long_about = None)]
|
#[command(version, about, long_about = None)]
|
||||||
struct Args {
|
struct Args {
|
||||||
|
|
@ -49,6 +52,9 @@ fn handle_command(args: &Args, issues_dir: &std::path::Path) -> anyhow::Result<(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() -> anyhow::Result<()> {
|
fn main() -> anyhow::Result<()> {
|
||||||
|
#[cfg(feature = "log")]
|
||||||
|
simple_logger::SimpleLogger::new().env().init().unwrap();
|
||||||
|
|
||||||
let args: Args = Args::parse();
|
let args: Args = Args::parse();
|
||||||
// println!("{:?}", args);
|
// println!("{:?}", args);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
#[cfg(feature = "log")]
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
#[derive(Debug, PartialEq, serde::Deserialize)]
|
#[derive(Debug, PartialEq, serde::Deserialize)]
|
||||||
/// These are the states an issue can be in.
|
/// These are the states an issue can be in.
|
||||||
pub enum State {
|
pub enum State {
|
||||||
|
|
@ -74,7 +77,8 @@ impl Issue {
|
||||||
dependencies = Some(deps);
|
dependencies = Some(deps);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
println!("ignoring unknown file in issue directory: {:?}", file_name);
|
#[cfg(feature = "log")]
|
||||||
|
debug!("ignoring unknown file in issue directory: {:?}", file_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
#[cfg(feature = "log")]
|
||||||
|
use log::debug;
|
||||||
|
|
||||||
// Just a placeholder for now, get rid of this if we don't need it.
|
// Just a placeholder for now, get rid of this if we don't need it.
|
||||||
#[derive(Debug, PartialEq, serde::Deserialize)]
|
#[derive(Debug, PartialEq, serde::Deserialize)]
|
||||||
pub struct Config {}
|
pub struct Config {}
|
||||||
|
|
@ -56,7 +59,8 @@ impl Issues {
|
||||||
} else if direntry.file_name() == "config.toml" {
|
} else if direntry.file_name() == "config.toml" {
|
||||||
issues.parse_config(direntry.path().as_path())?;
|
issues.parse_config(direntry.path().as_path())?;
|
||||||
} else {
|
} else {
|
||||||
println!(
|
#[cfg(feature = "log")]
|
||||||
|
debug!(
|
||||||
"ignoring unknown file in issues directory: {:?}",
|
"ignoring unknown file in issues directory: {:?}",
|
||||||
direntry.file_name()
|
direntry.file_name()
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue