diff --git a/Cargo.lock b/Cargo.lock index c33b54b..b4f445f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,12 +32,12 @@ dependencies = [ [[package]] name = "bake-agent-context" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "679a648005c2427a89cde61d5bfbd2752cba1d9d8bef7561a1bdb6bd7aefafc9" +checksum = "6e0c536a159ae7aa41ed8f5f1accda4dbbb8064eefeec9ca629fb02207f9a397" dependencies = [ "bake", - "core-markdown", + "base-markdown", "serde", "serde_json", "serde_yaml_ng", @@ -45,14 +45,14 @@ dependencies = [ [[package]] name = "bake-cargo" -version = "0.5.1" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f96d1c8367071572484df8adecb856ee9e4a412eccbe7189ae32c791c59184e" +checksum = "79ff5b8e99d484d51e46ea5e4a76f1e86c8751a7c92e62fa6825ab8858042c4b" dependencies = [ "bake", "bake-license", "bake-releases", - "core-markdown", + "base-markdown", "serde", "serde_json", "tempfile", @@ -62,12 +62,12 @@ dependencies = [ [[package]] name = "bake-license" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8c26cf7448bcbbd9ab961531e7484409f47d0e65b5af34e5dbf7a3ad445be0" +checksum = "6b873096492b2786ea7c0dd8ccc588b5919a052a13db753a5098950eb5e5e83e" dependencies = [ "bake", - "core-markdown", + "base-markdown", "tempfile", ] @@ -84,34 +84,34 @@ dependencies = [ [[package]] name = "bake-markdown" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f1bd6360b257635676292741245853283d8c9285e70a16da020dfd5cf94bcdd" +checksum = "4fb954a7e1e164bab8c4eca17399a2e79848b6b3b3a27afc89b35ec71b8130d5" dependencies = [ "bake", - "core-markdown", + "base-markdown", ] [[package]] name = "bake-readme" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bf6d1221735038caa856a503e964e885d2379c1980518d3ce71165063d4949" +checksum = "480bfb31790775eceb77a07726cfb1fb37e376bafcd68aa807047e3f0af09ffd" dependencies = [ "bake", - "core-markdown", + "base-markdown", "serde_json", "tempfile", ] [[package]] name = "bake-releases" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc0fdf00e4504ec28c13e0dcc9be5098d7cc0bb9009c4cb84c34ea683114b212" +checksum = "d31e33b847a5896ba5723b0391243e56172689720f9325c2c92e1fc57189e505" dependencies = [ "bake", - "core-markdown", + "base-markdown", "tempfile", ] @@ -127,35 +127,7 @@ dependencies = [ ] [[package]] -name = "base64" -version = "0.22.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" - -[[package]] -name = "bitflags" -version = "2.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" - -[[package]] -name = "cc" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" -dependencies = [ - "find-msvc-tools", - "shlex", -] - -[[package]] -name = "cfg-if" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" - -[[package]] -name = "core-console" +name = "base-console" version = "0.1.0" dependencies = [ "futures-lite", @@ -168,34 +140,33 @@ dependencies = [ ] [[package]] -name = "core-console-bake" +name = "base-console-bake" version = "0.0.0" dependencies = [ "bake", - "core-project", + "base-project", ] [[package]] -name = "core-design" +name = "base-design" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be086461795510f9e121dbafdb04bc8511ea26610ff185b7bba36d8747372b0" +checksum = "46f2f8db06d87ff80f4f96e56336afcb338b96b444ee8de7fe8919601e8de9b9" [[package]] -name = "core-markdown" +name = "base-markdown" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c12c75b62f77c8122be29431bcb028b97fa1e843e5a51cc9967a07ea9f4f08e3" +checksum = "7cfd2825b6e08635abf3737d8e15d8445c9d74ed80cefb4b469a19c140e90f33" dependencies = [ - "regex", - "unicode-id", + "memchr", ] [[package]] -name = "core-project" -version = "0.3.0" +name = "base-project" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c035542bf1cebf8b9636b4ab23aae2ed19f18abcfd8fcd67715ea1e9f7d62de7" +checksum = "b9e9c9d8865b2e1e53ee684ed25190c2c61b990e9d7e912069ced53270a64d2f" dependencies = [ "bake", "bake-agent-context", @@ -205,9 +176,37 @@ dependencies = [ "bake-readme", "bake-releases", "bake-test", - "core-design", + "base-design", ] +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + [[package]] name = "crc32fast" version = "1.5.3" @@ -588,18 +587,6 @@ version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" -[[package]] -name = "regex" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - [[package]] name = "regex-automata" version = "0.4.18" @@ -941,12 +928,6 @@ dependencies = [ "tracing-log", ] -[[package]] -name = "unicode-id" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65dd75ab2d9d379dbe86d4059e91d8b5a6e7054865eaba1ddbfc7a817ff96392" - [[package]] name = "unicode-ident" version = "1.0.27" diff --git a/Cargo.toml b/Cargo.toml index 75d6edb..9901dcf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,11 @@ [package] -name = "core-console" +name = "base-console" version = "0.1.0" edition = "2024" rust-version = "1.85" license = "MIT" -repository = "https://github.com/core-rs/core-console" -documentation = "https://docs.rs/core-console" +repository = "https://github.com/base-rs/base-console" +documentation = "https://docs.rs/base-console" description = "Automatic terminal and JSON diagnostics for tracing" keywords = ["logging", "tracing", "console", "diagnostics"] categories = ["development-tools::debugging"] @@ -20,7 +20,7 @@ resolver = "3" manifest = "bake/Cargo.toml" [workspace.metadata.bake.release] -reviewers = ["core-rs/maintainers"] +reviewers = ["base-rs/maintainers"] [dependencies] serde_json = { version = "1.0.154", features = ["arbitrary_precision"] } diff --git a/agents.md b/agents.md index c4bf019..60ca611 100644 --- a/agents.md +++ b/agents.md @@ -1,8 +1,8 @@ # Agent instructions -Run `cargo bake agent:context:install` to install dependency context and skills. Follow the Core conventions and relevant installed skills under `.agents/`. +Run `cargo bake agent:context:install` to install dependency context and skills. Follow the Base conventions and relevant installed skills under `.agents/`. -Before planning or changing behavior, discover and read applicable `design/*.md`. Use `core-design-review` to assess plans and changes, and `core-design-author` when user requirements are introduced, changed, or removed. Review design compliance before opening or updating a pull request. +Before planning or changing behavior, discover and read applicable `design/*.md`. Use `base-design-review` to assess plans and changes, and `base-design-author` when user requirements are introduced, changed, or removed. Review design compliance before opening or updating a pull request. Keep runtime dependencies independent of concrete schedulers. Libraries use ordinary `tracing` events; application setup, formatting, and captured failure diagnostics belong here. Development tooling belongs in the private `bake/` package. diff --git a/bake/Cargo.toml b/bake/Cargo.toml index 0830efe..e4ed143 100644 --- a/bake/Cargo.toml +++ b/bake/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "core-console-bake" +name = "base-console-bake" version = "0.0.0" edition = "2024" publish = false [dependencies] bake = ">=0.20, <1" -core-project = ">=0.3.0" +base-project = ">=0.1.0" diff --git a/bake/src/bake_generated_tasks/mod.rs b/bake/src/bake_generated_tasks/mod.rs index 0ab6c92..d54be9e 100644 --- a/bake/src/bake_generated_tasks/mod.rs +++ b/bake/src/bake_generated_tasks/mod.rs @@ -2,4 +2,4 @@ // Copyright, 2026, by Samuel Williams. // Generated by `cargo bake --regenerate`; do not edit. -use core_project as _; +use base_project as _; diff --git a/bake/tests/cli.rs b/bake/tests/cli.rs index 544f5cf..3f55c92 100644 --- a/bake/tests/cli.rs +++ b/bake/tests/cli.rs @@ -5,7 +5,7 @@ use std::process::Command; #[test] fn executable_lists_shared_tasks_and_reports_unknown_tasks() { - let output = Command::new(env!("CARGO_BIN_EXE_core-console-bake")) + let output = Command::new(env!("CARGO_BIN_EXE_base-console-bake")) .arg("--list") .output() .unwrap(); @@ -14,7 +14,7 @@ fn executable_lists_shared_tasks_and_reports_unknown_tasks() { for task in ["agent:context:install", "test:coverage", "cargo:release"] { assert!(listing.contains(task), "missing shared task {task}"); } - let output = Command::new(env!("CARGO_BIN_EXE_core-console-bake")) + let output = Command::new(env!("CARGO_BIN_EXE_base-console-bake")) .arg("unknown-task") .output() .unwrap(); diff --git a/examples/failure.rs b/examples/failure.rs index 25874be..40d7310 100644 --- a/examples/failure.rs +++ b/examples/failure.rs @@ -1,7 +1,7 @@ // Released under the MIT License. // Copyright, 2026, by Samuel Williams. -use core_console::{Console, Failure, OutputFormat}; +use base_console::{Console, Failure, OutputFormat}; use std::{backtrace::Backtrace, error::Error, fmt}; #[derive(Debug)] @@ -52,6 +52,6 @@ fn main() -> Result<(), Box> { } }); // The request scope has ended; its captured origin is still available. - core_console::failure!(failure, "Request failed"); + base_console::failure!(failure, "Request failed"); Ok(()) } diff --git a/readme.md b/readme.md index 66514d3..121e708 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# `core-console` +# `base-console` Automatic terminal and JSON diagnostics for Rust applications using `tracing`. @@ -9,18 +9,18 @@ Console chooses coloured, human-readable output when stderr is a terminal and ne Add Console and `tracing` to an application: ```sh -cargo add core-console +cargo add base-console cargo add tracing ``` ```rust fn main() { - core_console::init(); + base_console::init(); tracing::info!(connections = 3_u64, "Server started"); } ``` -`init` reads `RUST_LOG`, defaulting to `info`, and panics if setup fails. Use `core_console::try_init()?` to handle invalid filters or an already installed global subscriber. Both leave the `log` logger unchanged; applications may explicitly install `tracing_log::LogTracer` to include dependencies using `log`. +`init` reads `RUST_LOG`, defaulting to `info`, and panics if setup fails. Use `base_console::try_init()?` to handle invalid filters or an already installed global subscriber. Both leave the `log` logger unchanged; applications may explicitly install `tracing_log::LogTracer` to include dependencies using `log`. Try the demonstration: @@ -42,8 +42,8 @@ tracing::error!(error = &error as &dyn std::error::Error, "Request failed"); Use `Failure` to capture diagnostics at the point an error is wrapped, then retain or return it for later reporting: ```rust -let failure = core_console::Failure::capture(std::io::Error::other("connection closed")); -core_console::failure!(failure, "Request {} failed", 42); +let failure = base_console::Failure::capture(std::io::Error::other("connection closed")); +base_console::failure!(failure, "Request {} failed", 42); ``` The macro preserves the caller's target and source location. The wrapper captures a logical span trace when Console's layer is active, and an OS backtrace when `RUST_BACKTRACE` or `RUST_LIB_BACKTRACE` enables it. `Failure::with_backtrace` accepts a previously captured backtrace. Capture before leaving the failing operation: wrapping an error later cannot reconstruct its earlier stack. Logging the wrapper directly as `&dyn Error` preserves its causes; use `failure!` to include its captured traces as well. @@ -51,13 +51,13 @@ The macro preserves the caller's target and source location. The wrapper capture ### Composition and scoped output ```rust -use core_console::{Console, OutputFormat}; +use base_console::{Console, OutputFormat}; use tracing_subscriber::{layer::SubscriberExt, EnvFilter}; let console = Console::default() .with_format(OutputFormat::Text) .with_ansi(false) - .with_filter(EnvFilter::new("info,core_http=debug")); + .with_filter(EnvFilter::new("info,base_http=debug")); let subscriber = tracing_subscriber::registry().with(console.layer()); tracing::subscriber::with_default(subscriber, || { @@ -79,7 +79,7 @@ Writing is synchronous. Each console serializes complete records through its wri ## Development -The private `bake/` package depends on `core-project` for shared tooling: +The private `bake/` package depends on `base-project` for shared tooling: ```sh cargo bake test @@ -90,7 +90,7 @@ cargo bake test:coverage --all-targets true ## Releasing -Prepare a release with `cargo bake cargo:version:patch` (or `minor`, `major`, or `bump --version X.Y.Z`), commit it with a `Release: vVERSION` trailer, then run `cargo bake cargo:release` and open a pull request. After review and merge, GitHub Actions publishes the release when the configured `crates-io` environment approves it, then creates or updates the matching GitHub Release from `releases.md`. Follow the shared [Releasing skill](https://github.com/core-rs/core-project/blob/main/context/releasing.md) for the standard process. +Prepare a release with `cargo bake cargo:version:patch` (or `minor`, `major`, or `bump --version X.Y.Z`), commit it with a `Release: vVERSION` trailer, then run `cargo bake cargo:release` and open a pull request. After review and merge, GitHub Actions publishes the release when the configured `crates-io` environment approves it, then creates or updates the matching GitHub Release from `releases.md`. Follow the shared [Releasing skill](https://github.com/base-rs/base-project/blob/main/context/releasing.md) for the standard process. ## Releases @@ -99,6 +99,8 @@ See [releases.md](releases.md) for the full release history. ### v0.1.0 +- Publish as `base-console` in the `base-rs` organization, with package versions starting at 0.1.0. + - Choose terminal text or newline-delimited JSON automatically for `tracing` events. - Preserve typed fields, span context, and error causes through composable or scoped subscribers. - Capture failures with optional OS backtraces and logical span traces for later reporting. @@ -112,6 +114,6 @@ See [releases.md](releases.md) for the full release history. ## Contributing -Please open an issue or pull request on [GitHub](https://github.com/core-rs/core-console). +Please open an issue or pull request on [GitHub](https://github.com/base-rs/base-console). Run `cargo bake agent:context:install` to install shared context and skills for development. Use `cargo bake agent:context:list` and `cargo bake agent:context:show` to discover guidance. Follow `agents.md` and the installed skills under `.agents/skills/`. diff --git a/releases.md b/releases.md index 8ba19be..65b6e40 100644 --- a/releases.md +++ b/releases.md @@ -2,6 +2,8 @@ ## v0.1.0 +- Publish as `base-console` in the `base-rs` organization, with package versions starting at 0.1.0. + - Choose terminal text or newline-delimited JSON automatically for `tracing` events. - Preserve typed fields, span context, and error causes through composable or scoped subscribers. - Capture failures with optional OS backtraces and logical span traces for later reporting. diff --git a/src/lib.rs b/src/lib.rs index a94ba12..f491cbd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,7 @@ //! For existing subscribers and isolated captures, compose [`Console::layer`] instead. //! //! ```no_run -//! core_console::init(); +//! base_console::init(); //! tracing::info!(connections = 3_u64, "Server started"); //! ``` mod as_console_error; @@ -34,8 +34,8 @@ pub use as_console_error::AsConsoleError as __AsConsoleError; /// The error's causes remain typed; captured backtraces and original span context are included as text fields. Ordinary `tracing` subscribers can consume this event too. The failure expression is evaluated once. An explicit `target:` may override the caller's module path. /// /// ``` -/// let failure = core_console::Failure::capture(std::io::Error::other("disconnected")); -/// core_console::failure!(failure, "Request {} failed", 42); +/// let failure = base_console::Failure::capture(std::io::Error::other("disconnected")); +/// base_console::failure!(failure, "Request {} failed", 42); /// ``` #[macro_export] macro_rules! failure { diff --git a/tests/console.rs b/tests/console.rs index ca4484a..5b02406 100644 --- a/tests/console.rs +++ b/tests/console.rs @@ -1,7 +1,7 @@ // Released under the MIT License. // Copyright, 2026, by Samuel Williams. -use core_console::{Console, Failure, OutputFormat}; +use base_console::{Console, Failure, OutputFormat}; use serde_json::Value; use std::{ backtrace::{Backtrace, BacktraceStatus}, @@ -331,7 +331,7 @@ fn captured_failure_keeps_origin_after_span_updates_and_uses_the_callers_target( assert_eq!(failure.error().to_string(), "request failed"); assert_eq!(failure.to_string(), "request failed"); assert_eq!(failure.source().unwrap().to_string(), "peer reset"); - core_console::failure!(failure, "Request {} failed", 42); + base_console::failure!(failure, "Request {} failed", 42); assert_eq!(failure.into_inner().0.to_string(), "peer reset"); }, ); @@ -362,7 +362,7 @@ fn supplied_backtrace_is_reported_and_capture_works_without_a_subscriber() { let buffer = Buffer::default(); let failure = Failure::with_backtrace(io::Error::other("captured"), Backtrace::force_capture()); tracing::subscriber::with_default(buffer.console().subscriber(), || { - core_console::failure!(target: "explicit", failure, "Failure"); + base_console::failure!(target: "explicit", failure, "Failure"); }); let records = buffer.records(); assert_eq!(records[0]["target"], "explicit"); @@ -379,16 +379,16 @@ fn failure_reports_boxed_and_borrowed_error_trait_objects() { let buffer = Buffer::default(); tracing::subscriber::with_default(buffer.console().subscriber(), || { let error: Box = Box::new(RequestError(io::Error::other("boxed"))); - core_console::failure!(Failure::capture(error), "boxed error"); + base_console::failure!(Failure::capture(error), "boxed error"); let error: Box = Box::new(io::Error::other("send")); - core_console::failure!(Failure::capture(error), "send error"); + base_console::failure!(Failure::capture(error), "send error"); let error: Box = Box::new(io::Error::other("sync")); - core_console::failure!(Failure::capture(error), "sync error"); + base_console::failure!(Failure::capture(error), "sync error"); let error: Box = Box::new(io::Error::other("send and sync")); - core_console::failure!(Failure::capture(error), "send sync error"); + base_console::failure!(Failure::capture(error), "send sync error"); let error = io::Error::other("borrowed"); let error: &dyn Error = &error; - core_console::failure!(Failure::capture(error), "borrowed error"); + base_console::failure!(Failure::capture(error), "borrowed error"); }); let records = buffer.records(); assert_eq!(records.len(), 5); @@ -488,28 +488,28 @@ fn process_probe() { }; match mode.as_str() { "emit" => { - core_console::init(); + base_console::init(); tracing::info!("visible info"); tracing::warn!("visible warning"); tracing::debug!("hidden debug"); } "duplicate" => { - core_console::try_init().unwrap(); - let error = core_console::try_init().unwrap_err(); + base_console::try_init().unwrap(); + let error = base_console::try_init().unwrap_err(); assert!(matches!( error, - core_console::ConsoleInitError::Subscriber(_) + base_console::ConsoleInitError::Subscriber(_) )); assert!(error.to_string().contains("install")); assert!(error.source().is_some()); - assert!(std::panic::catch_unwind(core_console::init).is_err()); + assert!(std::panic::catch_unwind(base_console::init).is_err()); } "invalid" => { - let error = core_console::try_init().unwrap_err(); - assert!(matches!(error, core_console::ConsoleInitError::Filter(_))); + let error = base_console::try_init().unwrap_err(); + assert!(matches!(error, base_console::ConsoleInitError::Filter(_))); assert!(error.to_string().contains("filter")); assert!(error.source().is_some()); - assert!(std::panic::catch_unwind(core_console::init).is_err()); + assert!(std::panic::catch_unwind(base_console::init).is_err()); } "configured" => { let buffer = Buffer::default(); @@ -533,12 +533,12 @@ fn process_probe() { } static LOGGER: Logger = Logger; log::set_logger(&LOGGER).unwrap(); - core_console::init(); + base_console::init(); assert!(std::ptr::eq(log::logger(), &LOGGER as &dyn log::Log)); } "bridge" => { tracing_log::LogTracer::init().unwrap(); - core_console::init(); + base_console::init(); log::info!(target: "legacy_client", "bridged message"); } _ => panic!("unknown probe"),