diff --git a/Cargo.lock b/Cargo.lock index 36cc4c5..6842ae4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1403,7 +1403,7 @@ version = "0.0.1-placeholder" [[package]] name = "pkg6dev" -version = "0.1.1" +version = "0.5.1" dependencies = [ "anyhow", "clap 4.5.41", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "pkg6repo" -version = "0.0.1-placeholder" +version = "0.5.1" dependencies = [ "clap 4.5.41", "flate2", diff --git a/Cargo.toml b/Cargo.toml index 5d8d4d1..86fe4e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,5 +11,13 @@ members = [ "crates/*", "xtask", ] +resolver = "2" -resolver = "2" \ No newline at end of file +[workspace.package] +version = "0.5.1" +edition = "2024" +license-file = "LICENSE" +repository = "https://github.com/OpenFlowLabs/ips" +readme = "README.md" +keywords = ["packaging", "illumos"] +authors = ["Till Wegmueller "] \ No newline at end of file diff --git a/pkg6dev/Cargo.toml b/pkg6dev/Cargo.toml index 5033aa7..4c6fad7 100644 --- a/pkg6dev/Cargo.toml +++ b/pkg6dev/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "pkg6dev" -version = "0.1.1" -authors = ["Till Wegmueller "] -edition = "2018" -license-file = "LICENSE" +version.workspace = true +authors.workspace = true +edition.workspace = true +license-file.workspace = true description = "Helper tool for IPS package development" -repository = "https://github.com/OpenFlowLabs/ips" -readme = "README.md" -keywords = ["packaging", "illumos"] +repository.workspace = true +readme.workspace = true +keywords.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -16,7 +16,7 @@ libips = {path = "../libips", version = "0.1"} userland = {path = "../userland", version = "*"} clap = {version = "4", features = [ "derive" ] } tracing = "0.1" -tracing-subscriber = "0.3" +tracing-subscriber = { version = "0.3", features = ["env-filter"] } miette = { version = "7", features = ["fancy"] } thiserror = "2" anyhow = "1.0" \ No newline at end of file diff --git a/pkg6dev/src/error.rs b/pkg6dev/src/error.rs index c030a11..2a64b86 100644 --- a/pkg6dev/src/error.rs +++ b/pkg6dev/src/error.rs @@ -126,6 +126,14 @@ pub enum Pkg6DevError { path: PathBuf, }, + // Logging environment error + #[error("logging environment setup error: {0}")] + #[diagnostic( + code(ips::pkg6dev::logging_env_error), + help("Check your logging environment configuration and try again") + )] + LoggingEnvError(String), + // Generic custom error (for backward compatibility) #[error("{0}")] #[diagnostic( diff --git a/pkg6dev/src/main.rs b/pkg6dev/src/main.rs index a07d6c4..5910d97 100644 --- a/pkg6dev/src/main.rs +++ b/pkg6dev/src/main.rs @@ -10,7 +10,8 @@ use std::fs::{read_dir, OpenOptions}; use std::io::Write; use std::path::{Path, PathBuf}; use tracing::{debug, info, warn}; -use tracing_subscriber::fmt; +use tracing_subscriber::{fmt, EnvFilter}; +use tracing_subscriber::filter::LevelFilter; use userland::repology::find_newest_version; use userland::{Component, Makefile}; @@ -57,9 +58,16 @@ enum Commands { } fn main() -> Result<()> { - // Initialize the tracing subscriber with default log level as warning and no decorations + // Initialize the tracing subscriber with the default log level as debug and no decorations + // Parse the environment filter first, handling any errors with our custom error type + let env_filter = EnvFilter::builder() + .with_default_directive(LevelFilter::WARN.into()) + .from_env() + .map_err(|e| Pkg6DevError::LoggingEnvError(format!("Failed to parse environment filter: {}", e)))?; + fmt::Subscriber::builder() - .with_max_level(tracing::Level::WARN) + .with_max_level(tracing::Level::DEBUG) + .with_env_filter(env_filter) .without_time() .with_target(false) .with_ansi(false) diff --git a/pkg6repo/Cargo.toml b/pkg6repo/Cargo.toml index 713a783..6134aa7 100644 --- a/pkg6repo/Cargo.toml +++ b/pkg6repo/Cargo.toml @@ -1,13 +1,13 @@ [package] name = "pkg6repo" -version = "0.0.1-placeholder" -authors = ["Till Wegmueller "] -edition = "2018" -license-file = "LICENSE" +version.workspace = true +authors.workspace = true +edition.workspace = true +license-file.workspace = true description = "The repository management utility for IPS written in rust" -repository = "https://github.com/OpenFlowLabs/pkg6dev" -readme = "README.md" -keywords = ["packaging", "illumos"] +repository.workspace = true +readme.workspace = true +keywords.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html