diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index b7532f0639..9d4020ac6c 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -179,50 +179,38 @@ jobs: name: "cargo check (MSRV on ubuntu-latest)" needs: check runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: "install Rust ${{ env.MSRV }}" - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.MSRV }} - profile: minimal - - name: "install Rust nightly" - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - profile: minimal - - name: Select minimal versions - uses: actions-rs/cargo@v1 - with: - command: update - args: -Z minimal-versions - toolchain: nightly - - name: Check - uses: actions-rs/cargo@v1 - with: - command: check - # skip the following crates: - # - tracing-appender, as it has its own MSRV. - # TODO(eliza): remove this when appender is on the same MSRV as - # everything else - # - the examples, as they are not published & we don't care about - # MSRV support for them. - # - tracing-futures, as it depends on ancient tokio versions. - # TODO(eliza): remove this when the ancient tokio deps are dropped - args: >- - --workspace --all-features --locked - --exclude=tracing-appender - --exclude=tracing-examples - --exclude=tracing-futures - --exclude=tracing-opentelemetry - toolchain: ${{ env.MSRV }} - - # TODO: remove this once tracing's MSRV is bumped. - check-msrv-appender: - # Run `cargo check` on our minimum supported Rust version (1.53.0). - name: "cargo check (tracing-appender MSRV)" - needs: check - runs-on: ubuntu-latest + strategy: + matrix: + # cargo hack --feature-powerset will have a significant permutation + # number, we can't just use --all as it increases the runtime + # further than what we would like to + subcrate: + - tracing-appender + - tracing-attributes + - tracing-core + - tracing-futures + - tracing-log + - tracing-macros + - tracing-serde + - tracing-subscriber + - tracing-tower + - tracing-opentelemetry + - tracing + toolchain: + - 1.49.0 + - stable + # TODO(eliza): remove this when appender is on the same MSRV. + # same for tracing subscriber + exclude: + - subcrate: tracing-appender + toolchain: 1.49.0 + - subcrate: tracing-subscriber + toolchain: 1.49.0 + include: + - subcrate: tracing-appender + toolchain: 1.53.0 + - subcrate: tracing-subscriber + toolchain: 1.50.0 steps: - uses: actions/checkout@v3 - name: "install Rust ${{ env.APPENDER_MSRV }}" diff --git a/examples/Cargo.toml b/examples/Cargo.toml index c08515bc79..76d663a894 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -43,7 +43,7 @@ bytes = "1" argh = "0.1.8" # sloggish example -ansi_term = "0.12.1" +nu-ansi-term = "0.46.0" humantime = "2.1.0" log = "0.4.17" diff --git a/examples/examples/sloggish/sloggish_subscriber.rs b/examples/examples/sloggish/sloggish_subscriber.rs index f438ed6526..971e607fda 100644 --- a/examples/examples/sloggish/sloggish_subscriber.rs +++ b/examples/examples/sloggish/sloggish_subscriber.rs @@ -10,7 +10,7 @@ //! //! [`slog-term`]: https://docs.rs/slog-term/2.4.0/slog_term/ //! [`slog` README]: https://github.com/slog-rs/slog#terminal-output-example -use ansi_term::{Color, Style}; +use nu_ansi_term::{Color, Style}; use tracing::{ field::{Field, Visit}, Id, Level, Subscriber, @@ -129,7 +129,7 @@ impl<'a> Visit for Event<'a> { write!( &mut self.stderr, "{}", - // Have to alloc here due to `ansi_term`'s API... + // Have to alloc here due to `nu_ansi_term`'s API... Style::new().bold().paint(format!("{:?}", value)) ) .unwrap(); diff --git a/tracing-subscriber/Cargo.toml b/tracing-subscriber/Cargo.toml index 3ed2e0db5e..b580b5fccf 100644 --- a/tracing-subscriber/Cargo.toml +++ b/tracing-subscriber/Cargo.toml @@ -20,7 +20,7 @@ categories = [ "asynchronous", ] keywords = ["logging", "tracing", "metrics", "subscriber"] -rust-version = "1.49.0" +rust-version = "1.50.0" [features] @@ -29,7 +29,7 @@ alloc = [] std = ["alloc", "tracing-core/std"] env-filter = ["matchers", "regex", "once_cell", "tracing", "std", "thread_local"] fmt = ["registry", "std"] -ansi = ["fmt", "ansi_term"] +ansi = ["fmt", "nu-ansi-term"] registry = ["sharded-slab", "thread_local", "std"] json = ["tracing-serde", "serde", "serde_json"] valuable = ["tracing-core/valuable", "valuable_crate", "valuable-serde", "tracing-serde/valuable"] @@ -49,7 +49,7 @@ once_cell = { optional = true, version = "1.13.0" } # fmt tracing-log = { path = "../tracing-log", version = "0.1.3", optional = true, default-features = false, features = ["log-tracer", "std"] } -ansi_term = { version = "0.12.1", optional = true } +nu-ansi-term = { version = "0.46.0", optional = true } time = { version = "0.3.2", features = ["formatting"], optional = true } # only required by the json feature diff --git a/tracing-subscriber/README.md b/tracing-subscriber/README.md index ba2b4e1c33..124fb956d0 100644 --- a/tracing-subscriber/README.md +++ b/tracing-subscriber/README.md @@ -32,14 +32,14 @@ Utilities for implementing and composing [`tracing`][tracing] subscribers. [discord-url]: https://discord.gg/EeF3cQw [maint-badge]: https://img.shields.io/badge/maintenance-experimental-blue.svg -*Compiler support: [requires `rustc` 1.49+][msrv]* +*Compiler support: [requires `rustc` 1.50+][msrv]* [msrv]: #supported-rust-versions ## Supported Rust Versions Tracing is built against the latest stable release. The minimum supported -version is 1.49. The current Tracing version is not guaranteed to build on Rust +version is 1.50. The current Tracing version is not guaranteed to build on Rust versions earlier than the minimum supported version. Tracing follows the same compiler support policies as the rest of the Tokio diff --git a/tracing-subscriber/src/filter/env/builder.rs b/tracing-subscriber/src/filter/env/builder.rs index f776f1f18e..c814707e6c 100644 --- a/tracing-subscriber/src/filter/env/builder.rs +++ b/tracing-subscriber/src/filter/env/builder.rs @@ -209,15 +209,15 @@ impl Builder { } if !disabled.is_empty() { - #[cfg(feature = "ansi_term")] - use ansi_term::{Color, Style}; + #[cfg(feature = "nu_ansi_term")] + use nu_ansi_term::{Color, Style}; // NOTE: We can't use a configured `MakeWriter` because the EnvFilter // has no knowledge of any underlying subscriber or collector, which // may or may not use a `MakeWriter`. let warn = |msg: &str| { - #[cfg(not(feature = "ansi_term"))] + #[cfg(not(feature = "nu_ansi_term"))] let msg = format!("warning: {}", msg); - #[cfg(feature = "ansi_term")] + #[cfg(feature = "nu_ansi_term")] let msg = { let bold = Style::new().bold(); let mut warning = Color::Yellow.paint("warning"); @@ -227,9 +227,9 @@ impl Builder { eprintln!("{}", msg); }; let ctx_prefixed = |prefix: &str, msg: &str| { - #[cfg(not(feature = "ansi_term"))] + #[cfg(not(feature = "nu_ansi_term"))] let msg = format!("{} {}", prefix, msg); - #[cfg(feature = "ansi_term")] + #[cfg(feature = "nu_ansi_term")] let msg = { let mut equal = Color::Fixed(21).paint("="); // dark blue equal.style_ref_mut().is_bold = true; @@ -240,9 +240,9 @@ impl Builder { let ctx_help = |msg| ctx_prefixed("help:", msg); let ctx_note = |msg| ctx_prefixed("note:", msg); let ctx = |msg: &str| { - #[cfg(not(feature = "ansi_term"))] + #[cfg(not(feature = "nu_ansi_term"))] let msg = format!("note: {}", msg); - #[cfg(feature = "ansi_term")] + #[cfg(feature = "nu_ansi_term")] let msg = { let mut pipe = Color::Fixed(21).paint("|"); pipe.style_ref_mut().is_bold = true; diff --git a/tracing-subscriber/src/fmt/format/mod.rs b/tracing-subscriber/src/fmt/format/mod.rs index ec79ac1402..88de10e7aa 100644 --- a/tracing-subscriber/src/fmt/format/mod.rs +++ b/tracing-subscriber/src/fmt/format/mod.rs @@ -46,7 +46,7 @@ use tracing_core::{ use tracing_log::NormalizeEvent; #[cfg(feature = "ansi")] -use ansi_term::{Colour, Style}; +use nu_ansi_term::{Color, Style}; #[cfg(feature = "json")] mod json; @@ -101,7 +101,7 @@ pub use pretty::*; /// does not support ANSI escape codes (such as a log file), and they should /// not be emitted. /// -/// Crates like [`ansi_term`] and [`owo-colors`] can be used to add ANSI +/// Crates like [`nu_ansi_term`] and [`owo-colors`] can be used to add ANSI /// escape codes to formatted output. /// /// * The actual [`Event`] to be formatted. @@ -189,7 +189,7 @@ pub use pretty::*; /// [implements `FormatFields`]: super::FmtContext#impl-FormatFields<'writer> /// [ANSI terminal escape codes]: https://en.wikipedia.org/wiki/ANSI_escape_code /// [`Writer::has_ansi_escapes`]: Writer::has_ansi_escapes -/// [`ansi_term`]: https://crates.io/crates/ansi_term +/// [`nu_ansi_term`]: https://crates.io/crates/nu_ansi_term /// [`owo-colors`]: https://crates.io/crates/owo-colors /// [default formatter]: Full pub trait FormatEvent @@ -1483,13 +1483,13 @@ impl<'a> fmt::Display for FmtLevel<'a> { impl<'a> fmt::Display for FmtLevel<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { if self.ansi { - match *self.level { - Level::TRACE => write!(f, "{}", Colour::Purple.paint(TRACE_STR)), - Level::DEBUG => write!(f, "{}", Colour::Blue.paint(DEBUG_STR)), - Level::INFO => write!(f, "{}", Colour::Green.paint(INFO_STR)), - Level::WARN => write!(f, "{}", Colour::Yellow.paint(WARN_STR)), - Level::ERROR => write!(f, "{}", Colour::Red.paint(ERROR_STR)), - } + return match *self.level { + Level::TRACE => write!(f, "{}", Color::Purple.paint(TRACE_STR)), + Level::DEBUG => write!(f, "{}", Color::Blue.paint(DEBUG_STR)), + Level::INFO => write!(f, "{}", Color::Green.paint(INFO_STR)), + Level::WARN => write!(f, "{}", Color::Yellow.paint(WARN_STR)), + Level::ERROR => write!(f, "{}", Color::Red.paint(ERROR_STR)), + }; } else { match *self.level { Level::TRACE => f.pad(TRACE_STR), diff --git a/tracing-subscriber/src/fmt/format/pretty.rs b/tracing-subscriber/src/fmt/format/pretty.rs index a50d08ba75..12071de922 100644 --- a/tracing-subscriber/src/fmt/format/pretty.rs +++ b/tracing-subscriber/src/fmt/format/pretty.rs @@ -14,7 +14,7 @@ use tracing_core::{ #[cfg(feature = "tracing-log")] use tracing_log::NormalizeEvent; -use ansi_term::{Colour, Style}; +use nu_ansi_term::{Color, Style}; /// An excessively pretty, human-readable event formatter. /// @@ -143,11 +143,11 @@ impl Default for Pretty { impl Pretty { fn style_for(level: &Level) -> Style { match *level { - Level::TRACE => Style::new().fg(Colour::Purple), - Level::DEBUG => Style::new().fg(Colour::Blue), - Level::INFO => Style::new().fg(Colour::Green), - Level::WARN => Style::new().fg(Colour::Yellow), - Level::ERROR => Style::new().fg(Colour::Red), + Level::TRACE => Style::new().fg(Color::Purple), + Level::DEBUG => Style::new().fg(Color::Blue), + Level::INFO => Style::new().fg(Color::Green), + Level::WARN => Style::new().fg(Color::Yellow), + Level::ERROR => Style::new().fg(Color::Red), } } diff --git a/tracing-subscriber/src/lib.rs b/tracing-subscriber/src/lib.rs index 9de70a90d1..8089230071 100644 --- a/tracing-subscriber/src/lib.rs +++ b/tracing-subscriber/src/lib.rs @@ -10,7 +10,7 @@ //! `tracing-subscriber` is intended for use by both `Subscriber` authors and //! application authors using `tracing` to instrument their applications. //! -//! *Compiler support: [requires `rustc` 1.49+][msrv]* +//! *Compiler support: [requires `rustc` 1.50+][msrv]* //! //! [msrv]: #supported-rust-versions //! @@ -138,7 +138,7 @@ //! ## Supported Rust Versions //! //! Tracing is built against the latest stable release. The minimum supported -//! version is 1.49. The current Tracing version is not guaranteed to build on +//! version is 1.50. The current Tracing version is not guaranteed to build on //! Rust versions earlier than the minimum supported version. //! //! Tracing follows the same compiler support policies as the rest of the Tokio