| #![allow(dead_code, unused_imports)] | ||
| use log::{debug, error, info, trace, warn, Level, LevelFilter, Log, Metadata, Record}; | ||
| use std::sync::{Arc, Mutex}; | ||
| struct State { | ||
| last_log_level: Mutex<Option<Level>>, | ||
| last_log_location: Mutex<Option<u32>>, | ||
| } | ||
| struct Logger(Arc<State>); | ||
| impl Log for Logger { | ||
| fn enabled(&self, _: &Metadata) -> bool { | ||
| true | ||
| } | ||
| fn log(&self, record: &Record) { | ||
| *self.0.last_log_level.lock().unwrap() = Some(record.level()); | ||
| *self.0.last_log_location.lock().unwrap() = record.line(); | ||
| } | ||
| fn flush(&self) {} | ||
| } | ||
| #[test] | ||
| fn test_integration() { | ||
| // These tests don't really make sense when static | ||
| // max level filtering is applied | ||
| #[cfg(not(any( | ||
| feature = "max_level_off", | ||
| feature = "max_level_error", | ||
| feature = "max_level_warn", | ||
| feature = "max_level_info", | ||
| feature = "max_level_debug", | ||
| feature = "max_level_trace", | ||
| feature = "release_max_level_off", | ||
| feature = "release_max_level_error", | ||
| feature = "release_max_level_warn", | ||
| feature = "release_max_level_info", | ||
| feature = "release_max_level_debug", | ||
| feature = "release_max_level_trace", | ||
| )))] | ||
| { | ||
| let me = Arc::new(State { | ||
| last_log_level: Mutex::new(None), | ||
| last_log_location: Mutex::new(None), | ||
| }); | ||
| let a = me.clone(); | ||
| let logger = Logger(me); | ||
| test_filter(&logger, &a, LevelFilter::Off); | ||
| test_filter(&logger, &a, LevelFilter::Error); | ||
| test_filter(&logger, &a, LevelFilter::Warn); | ||
| test_filter(&logger, &a, LevelFilter::Info); | ||
| test_filter(&logger, &a, LevelFilter::Debug); | ||
| test_filter(&logger, &a, LevelFilter::Trace); | ||
| test_line_numbers(&logger, &a); | ||
| } | ||
| } | ||
| fn test_filter(logger: &dyn Log, a: &State, filter: LevelFilter) { | ||
| // tests to ensure logs with a level beneath 'max_level' are filtered out | ||
| log::set_max_level(filter); | ||
| error!(logger: logger, ""); | ||
| last(a, t(Level::Error, filter)); | ||
| warn!(logger: logger, ""); | ||
| last(a, t(Level::Warn, filter)); | ||
| info!(logger: logger, ""); | ||
| last(a, t(Level::Info, filter)); | ||
| debug!(logger: logger, ""); | ||
| last(a, t(Level::Debug, filter)); | ||
| trace!(logger: logger, ""); | ||
| last(a, t(Level::Trace, filter)); | ||
| fn t(lvl: Level, filter: LevelFilter) -> Option<Level> { | ||
| if lvl <= filter { | ||
| Some(lvl) | ||
| } else { | ||
| None | ||
| } | ||
| } | ||
| fn last(state: &State, expected: Option<Level>) { | ||
| let lvl = state.last_log_level.lock().unwrap().take(); | ||
| assert_eq!(lvl, expected); | ||
| } | ||
| } | ||
| fn test_line_numbers(logger: &dyn Log, state: &State) { | ||
| log::set_max_level(LevelFilter::Trace); | ||
| info!(logger: logger, ""); // ensure check_line function follows log macro | ||
| check_log_location(state); | ||
| #[track_caller] | ||
| fn check_log_location(state: &State) { | ||
| let location = std::panic::Location::caller().line(); // get function calling location | ||
| let line_number = state.last_log_location.lock().unwrap().take().unwrap(); // get location of most recent log | ||
| assert_eq!(line_number, location - 1); | ||
| } | ||
| } |
+429
| use log::{log, log_enabled, Log, Metadata, Record}; | ||
| macro_rules! all_log_macros { | ||
| ($($arg:tt)*) => ({ | ||
| ::log::trace!($($arg)*); | ||
| ::log::debug!($($arg)*); | ||
| ::log::info!($($arg)*); | ||
| ::log::warn!($($arg)*); | ||
| ::log::error!($($arg)*); | ||
| }); | ||
| } | ||
| // Not `Copy` | ||
| struct Logger; | ||
| impl Log for Logger { | ||
| fn enabled(&self, _: &Metadata) -> bool { | ||
| false | ||
| } | ||
| fn log(&self, _: &Record) {} | ||
| fn flush(&self) {} | ||
| } | ||
| #[test] | ||
| fn no_args() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello"); | ||
| log!(lvl, "hello",); | ||
| log!(target: "my_target", lvl, "hello"); | ||
| log!(target: "my_target", lvl, "hello",); | ||
| log!(logger: logger, lvl, "hello"); | ||
| log!(logger: logger, lvl, "hello",); | ||
| log!(logger: logger, target: "my_target", lvl, "hello"); | ||
| log!(logger: logger, target: "my_target", lvl, "hello",); | ||
| } | ||
| all_log_macros!("hello"); | ||
| all_log_macros!("hello",); | ||
| all_log_macros!(target: "my_target", "hello"); | ||
| all_log_macros!(target: "my_target", "hello",); | ||
| all_log_macros!(logger: logger, "hello"); | ||
| all_log_macros!(logger: logger, "hello",); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello"); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello",); | ||
| } | ||
| #[test] | ||
| fn anonymous_args() { | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello {}", "world"); | ||
| log!(lvl, "hello {}", "world",); | ||
| log!(target: "my_target", lvl, "hello {}", "world"); | ||
| log!(target: "my_target", lvl, "hello {}", "world",); | ||
| log!(lvl, "hello {}", "world"); | ||
| log!(lvl, "hello {}", "world",); | ||
| } | ||
| all_log_macros!("hello {}", "world"); | ||
| all_log_macros!("hello {}", "world",); | ||
| all_log_macros!(target: "my_target", "hello {}", "world"); | ||
| all_log_macros!(target: "my_target", "hello {}", "world",); | ||
| let logger = Logger; | ||
| all_log_macros!(logger: logger, "hello {}", "world"); | ||
| all_log_macros!(logger: logger, "hello {}", "world",); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {}", "world"); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {}", "world",); | ||
| } | ||
| #[test] | ||
| fn named_args() { | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello {world}", world = "world"); | ||
| log!(lvl, "hello {world}", world = "world",); | ||
| log!(target: "my_target", lvl, "hello {world}", world = "world"); | ||
| log!(target: "my_target", lvl, "hello {world}", world = "world",); | ||
| log!(lvl, "hello {world}", world = "world"); | ||
| log!(lvl, "hello {world}", world = "world",); | ||
| } | ||
| all_log_macros!("hello {world}", world = "world"); | ||
| all_log_macros!("hello {world}", world = "world",); | ||
| all_log_macros!(target: "my_target", "hello {world}", world = "world"); | ||
| all_log_macros!(target: "my_target", "hello {world}", world = "world",); | ||
| let logger = Logger; | ||
| all_log_macros!(logger: logger, "hello {world}", world = "world"); | ||
| all_log_macros!(logger: logger, "hello {world}", world = "world",); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {world}", world = "world"); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {world}", world = "world",); | ||
| } | ||
| #[test] | ||
| fn inlined_args() { | ||
| let world = "world"; | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello {world}"); | ||
| log!(lvl, "hello {world}",); | ||
| log!(target: "my_target", lvl, "hello {world}"); | ||
| log!(target: "my_target", lvl, "hello {world}",); | ||
| log!(lvl, "hello {world}"); | ||
| log!(lvl, "hello {world}",); | ||
| } | ||
| all_log_macros!("hello {world}"); | ||
| all_log_macros!("hello {world}",); | ||
| all_log_macros!(target: "my_target", "hello {world}"); | ||
| all_log_macros!(target: "my_target", "hello {world}",); | ||
| let logger = Logger; | ||
| all_log_macros!(logger: logger, "hello {world}"); | ||
| all_log_macros!(logger: logger, "hello {world}",); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {world}"); | ||
| all_log_macros!(logger: logger, target: "my_target", "hello {world}",); | ||
| } | ||
| #[test] | ||
| fn enabled() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| let _enabled = log_enabled!(lvl); | ||
| let _enabled = log_enabled!(target: "my_target", lvl); | ||
| let _enabled = log_enabled!(logger: logger, target: "my_target", lvl); | ||
| let _enabled = log_enabled!(logger: logger, lvl); | ||
| } | ||
| } | ||
| #[test] | ||
| fn expr() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello"); | ||
| log!(logger: logger, lvl, "hello"); | ||
| } | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_no_args() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| log!(lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| log!(logger: logger, target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| log!(logger: logger, lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| } | ||
| all_log_macros!(target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| all_log_macros!(target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| all_log_macros!(cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| all_log_macros!(logger: logger, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| all_log_macros!(logger: logger, target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_expr_args() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| log!(lvl, target = "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| log!(lvl, cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| log!(logger: logger, target: "my_target", lvl, cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| log!(logger: logger, lvl, target = "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| log!(logger: logger, lvl, cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| } | ||
| all_log_macros!(target: "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| all_log_macros!(target = "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| all_log_macros!(cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| all_log_macros!(logger: logger, target: "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| all_log_macros!(logger: logger, target = "my_target", cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| all_log_macros!(logger: logger, cat_math = { let mut x = 0; x += 1; x + 1 }; "hello"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_anonymous_args() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| log!(lvl, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| log!(lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| log!(logger: logger, target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| log!(logger: logger, lvl, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| log!(logger: logger, lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| } | ||
| all_log_macros!(target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| all_log_macros!(target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| all_log_macros!(cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| all_log_macros!(logger: logger, target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| all_log_macros!(logger: logger, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| all_log_macros!(logger: logger, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {}", "world"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_named_args() { | ||
| let logger = Logger; | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| log!(lvl, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| log!(lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| log!(logger: logger, target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| log!(logger: logger, lvl, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| log!(logger: logger, lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| } | ||
| all_log_macros!(target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| all_log_macros!(target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| all_log_macros!(cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| all_log_macros!(logger: logger, target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| all_log_macros!(logger: logger, target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| all_log_macros!(logger: logger, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}", world = "world"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_ident() { | ||
| let cat_1 = "chashu"; | ||
| let cat_2 = "nori"; | ||
| all_log_macros!(cat_1, cat_2:%, cat_count = 2; "hello {world}", world = "world"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_expr_context() { | ||
| match "chashu" { | ||
| cat_1 => { | ||
| log::info!(target: "target", cat_1 = cat_1, cat_2 = "nori"; "hello {}", "cats"); | ||
| } | ||
| }; | ||
| } | ||
| #[test] | ||
| fn implicit_named_args() { | ||
| let world = "world"; | ||
| for lvl in log::Level::iter() { | ||
| log!(lvl, "hello {world}"); | ||
| log!(lvl, "hello {world}",); | ||
| log!(target: "my_target", lvl, "hello {world}"); | ||
| log!(target: "my_target", lvl, "hello {world}",); | ||
| log!(lvl, "hello {world}"); | ||
| log!(lvl, "hello {world}",); | ||
| } | ||
| all_log_macros!("hello {world}"); | ||
| all_log_macros!("hello {world}",); | ||
| all_log_macros!(target: "my_target", "hello {world}"); | ||
| all_log_macros!(target: "my_target", "hello {world}",); | ||
| #[cfg(feature = "kv")] | ||
| all_log_macros!(target = "my_target"; "hello {world}"); | ||
| #[cfg(feature = "kv")] | ||
| all_log_macros!(target = "my_target"; "hello {world}",); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_implicit_named_args() { | ||
| let world = "world"; | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}"); | ||
| log!(lvl, cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}"); | ||
| } | ||
| all_log_macros!(target: "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}"); | ||
| all_log_macros!(target = "my_target", cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}"); | ||
| all_log_macros!(cat_1 = "chashu", cat_2 = "nori", cat_count = 2; "hello {world}"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_string_keys() { | ||
| for lvl in log::Level::iter() { | ||
| log!(target: "my_target", lvl, "also dogs" = "Fílos", "key/that-can't/be/an/ident" = "hi"; "hello {world}", world = "world"); | ||
| } | ||
| all_log_macros!(target: "my_target", "also dogs" = "Fílos", "key/that-can't/be/an/ident" = "hi"; "hello {world}", world = "world"); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_common_value_types() { | ||
| all_log_macros!( | ||
| u8 = 42u8, | ||
| u16 = 42u16, | ||
| u32 = 42u32, | ||
| u64 = 42u64, | ||
| u128 = 42u128, | ||
| i8 = -42i8, | ||
| i16 = -42i16, | ||
| i32 = -42i32, | ||
| i64 = -42i64, | ||
| i128 = -42i128, | ||
| f32 = 4.2f32, | ||
| f64 = -4.2f64, | ||
| bool = true, | ||
| str = "string"; | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_debug() { | ||
| all_log_macros!( | ||
| a:? = 42, | ||
| b:debug = 42; | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv")] | ||
| fn kv_display() { | ||
| all_log_macros!( | ||
| a:% = 42, | ||
| b:display = 42; | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv_std")] | ||
| fn kv_error() { | ||
| all_log_macros!( | ||
| a:err = std::io::Error::new(std::io::ErrorKind::Other, "an error"); | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv_sval")] | ||
| fn kv_sval() { | ||
| all_log_macros!( | ||
| a:sval = 42; | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| #[cfg(feature = "kv_serde")] | ||
| fn kv_serde() { | ||
| all_log_macros!( | ||
| a:serde = 42; | ||
| "hello world" | ||
| ); | ||
| } | ||
| #[test] | ||
| fn logger_short_lived() { | ||
| all_log_macros!(logger: Logger, "hello"); | ||
| all_log_macros!(logger: &Logger, "hello"); | ||
| } | ||
| #[test] | ||
| fn logger_expr() { | ||
| all_log_macros!(logger: { | ||
| let logger = Logger; | ||
| logger | ||
| }, "hello"); | ||
| } | ||
| /// Some and None (from Option) are used in the macros. | ||
| #[derive(Debug)] | ||
| enum Type { | ||
| Some, | ||
| None, | ||
| } | ||
| #[test] | ||
| fn regression_issue_494() { | ||
| use self::Type::*; | ||
| all_log_macros!("some message: {:?}, {:?}", None, Some); | ||
| } |
| { | ||
| "git": { | ||
| "sha1": "35161d0d25838a62d518dabe1e34e84b607446b3" | ||
| "sha1": "6e1735597bb21c5d979a077395df85e1d633e077" | ||
| }, | ||
| "path_in_vcs": "" | ||
| } |
| name: CI | ||
| on: [push, pull_request] | ||
| # Ensure only read permission is granted | ||
| permissions: | ||
| contents: read # to fetch code (actions/checkout) | ||
| contents: read | ||
@@ -13,3 +14,2 @@ jobs: | ||
| matrix: | ||
| build: [stable, beta, nightly, macos, win32, win64, mingw] | ||
| include: | ||
@@ -38,41 +38,26 @@ - build: stable | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
| rustup update ${{ matrix.rust }} --no-self-update | ||
| rustup default ${{ matrix.rust }} | ||
| cargo install cargo-hack | ||
| - run: cargo hack test --feature-powerset --lib --exclude-features max_level_off,max_level_error,max_level_warn,max_level_info,max_level_debug,max_level_trace,release_max_level_off,release_max_level_error,release_max_level_warn,release_max_level_info,release_max_level_debug,release_max_level_trace | ||
| cargo +stable install cargo-hack --locked | ||
| - run: cargo hack test --feature-powerset --exclude-features max_level_off,max_level_error,max_level_warn,max_level_info,max_level_debug,max_level_trace,release_max_level_off,release_max_level_error,release_max_level_warn,release_max_level_info,release_max_level_debug,release_max_level_trace | ||
| - run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml | ||
| - run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml --release | ||
| rustfmt: | ||
| name: Rustfmt | ||
| check: | ||
| name: Check Format and Clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
| rustup update stable --no-self-update | ||
| rustup default stable | ||
| rustup component add rustfmt | ||
| # log repo does not use Cargo workspaces, so `cargo fmt` will not check all the code | ||
| # perhaps this should be changed in the future | ||
| rustup component add clippy rustfmt | ||
| - run: cargo fmt -- --check | ||
| - run: cargo fmt --manifest-path test_max_level_features/Cargo.toml -- --check | ||
| - run: cargo fmt --manifest-path tests/Cargo.toml -- --check | ||
| clippy: | ||
| name: Clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| run: | | ||
| rustup update stable --no-self-update | ||
| rustup default stable | ||
| rustup component add clippy | ||
| - run: cargo clippy --verbose | ||
| - run: cargo clippy --verbose --manifest-path test_max_level_features/Cargo.toml | ||
| - run: cargo clippy --verbose --manifest-path tests/Cargo.toml | ||
@@ -83,4 +68,4 @@ doc: | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
@@ -91,3 +76,5 @@ rustup update stable --no-self-update | ||
| - name: Run rustdoc | ||
| run: RUSTDOCFLAGS="-D warnings" cargo doc --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde | ||
| env: | ||
| RUSTDOCFLAGS: "-D warnings" | ||
| run: cargo doc --verbose --features std,serde,sval,sval_ref,value-bag,kv,kv_std,kv_sval,kv_serde | ||
@@ -98,4 +85,4 @@ features: | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
@@ -115,4 +102,4 @@ rustup update nightly --no-self-update | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
@@ -132,10 +119,11 @@ rustup update nightly --no-self-update | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
| rustup update 1.60.0 --no-self-update | ||
| rustup default 1.60.0 | ||
| - run: | | ||
| cargo test --verbose --manifest-path tests/Cargo.toml | ||
| cargo test --verbose --manifest-path tests/Cargo.toml --features kv | ||
| rustup update 1.61.0 --no-self-update | ||
| rustup default 1.61.0 | ||
| cargo +stable install cargo-hack --locked | ||
| - run: cargo hack test --feature-powerset --exclude-features max_level_off,max_level_error,max_level_warn,max_level_info,max_level_debug,max_level_trace,release_max_level_off,release_max_level_error,release_max_level_warn,release_max_level_info,release_max_level_debug,release_max_level_trace | ||
| - run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml | ||
| - run: cargo run --verbose --manifest-path test_max_level_features/Cargo.toml --release | ||
@@ -146,4 +134,4 @@ embedded: | ||
| steps: | ||
| - uses: actions/checkout@master | ||
| - name: Install Rust | ||
| - uses: actions/checkout@v4 | ||
| - name: Install toolchain | ||
| run: | | ||
@@ -150,0 +138,0 @@ rustup update stable --no-self-update |
+15
-15
@@ -23,3 +23,3 @@ # This file is automatically @generated by Cargo. | ||
| name = "log" | ||
| version = "0.4.27" | ||
| version = "0.4.28" | ||
| dependencies = [ | ||
@@ -38,11 +38,11 @@ "proc-macro2", | ||
| name = "memchr" | ||
| version = "2.7.4" | ||
| version = "2.7.5" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" | ||
| checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" | ||
| [[package]] | ||
| name = "proc-macro2" | ||
| version = "1.0.94" | ||
| version = "1.0.101" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" | ||
| checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de" | ||
| dependencies = [ | ||
@@ -98,5 +98,5 @@ "unicode-ident", | ||
| name = "serde_json" | ||
| version = "1.0.140" | ||
| version = "1.0.143" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" | ||
| checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a" | ||
| dependencies = [ | ||
@@ -218,5 +218,5 @@ "itoa", | ||
| name = "syn" | ||
| version = "2.0.100" | ||
| version = "2.0.106" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" | ||
| checksum = "ede7c438028d4436d71104916910f5bb611972c5cfd7f89b8300a8186e6fada6" | ||
| dependencies = [ | ||
@@ -242,5 +242,5 @@ "proc-macro2", | ||
| name = "value-bag" | ||
| version = "1.10.0" | ||
| version = "1.11.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" | ||
| checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" | ||
| dependencies = [ | ||
@@ -253,5 +253,5 @@ "value-bag-serde1", | ||
| name = "value-bag-serde1" | ||
| version = "1.10.0" | ||
| version = "1.11.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "4bb773bd36fd59c7ca6e336c94454d9c66386416734817927ac93d81cb3c5b0b" | ||
| checksum = "35540706617d373b118d550d41f5dfe0b78a0c195dc13c6815e92e2638432306" | ||
| dependencies = [ | ||
@@ -265,5 +265,5 @@ "erased-serde", | ||
| name = "value-bag-sval2" | ||
| version = "1.10.0" | ||
| version = "1.11.1" | ||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||
| checksum = "53a916a702cac43a88694c97657d449775667bcd14b70419441d05b7fea4a83a" | ||
| checksum = "6fe7e140a2658cc16f7ee7a86e413e803fc8f9b5127adc8755c19f9fefa63a52" | ||
| dependencies = [ | ||
@@ -270,0 +270,0 @@ "sval", |
+11
-3
@@ -14,5 +14,5 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO | ||
| edition = "2021" | ||
| rust-version = "1.60.0" | ||
| rust-version = "1.61.0" | ||
| name = "log" | ||
| version = "0.4.27" | ||
| version = "0.4.28" | ||
| authors = ["The Rust Project Developers"] | ||
@@ -97,2 +97,10 @@ build = false | ||
| [[test]] | ||
| name = "integration" | ||
| path = "tests/integration.rs" | ||
| [[test]] | ||
| name = "macros" | ||
| path = "tests/macros.rs" | ||
| [[bench]] | ||
@@ -108,3 +116,3 @@ name = "value" | ||
| [dependencies.sval] | ||
| version = "2.1" | ||
| version = "2.14.1" | ||
| optional = true | ||
@@ -111,0 +119,0 @@ default-features = false |
+31
-11
@@ -5,5 +5,23 @@ # Change Log | ||
| ## [0.4.28] - 2025-09-02 | ||
| ## What's Changed | ||
| * ci: drop really old trick and ensure MSRV for all feature combo by @tisonkun in https://github.com/rust-lang/log/pull/676 | ||
| * Chore: delete compare_exchange method for AtomicUsize on platforms without atomics by @HaoliangXu in https://github.com/rust-lang/log/pull/690 | ||
| * Add `increment_severity()` and `decrement_severity()` methods for `Level` and `LevelFilter` by @nebkor in https://github.com/rust-lang/log/pull/692 | ||
| ## New Contributors | ||
| * @xixishidibei made their first contribution in https://github.com/rust-lang/log/pull/677 | ||
| * @ZylosLumen made their first contribution in https://github.com/rust-lang/log/pull/688 | ||
| * @HaoliangXu made their first contribution in https://github.com/rust-lang/log/pull/690 | ||
| * @nebkor made their first contribution in https://github.com/rust-lang/log/pull/692 | ||
| **Full Changelog**: https://github.com/rust-lang/log/compare/0.4.27...0.4.28 | ||
| ### Notable Changes | ||
| * MSRV is bumped to 1.61.0 in https://github.com/rust-lang/log/pull/676 | ||
| ## [0.4.27] - 2025-03-24 | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * A few minor lint fixes by @nyurik in https://github.com/rust-lang/log/pull/671 | ||
@@ -17,5 +35,6 @@ * Enable clippy support for format-like macros by @nyurik in https://github.com/rust-lang/log/pull/665 | ||
| ## [0.4.26] - 2025-02-18 | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Derive `Clone` for `kv::Value` by @SpriteOvO in https://github.com/rust-lang/log/pull/668 | ||
@@ -29,3 +48,3 @@ * Add `spdlog-rs` link to crate doc by @SpriteOvO in https://github.com/rust-lang/log/pull/669 | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Revert loosening of kv cargo features by @KodrAus in https://github.com/rust-lang/log/pull/662 | ||
@@ -38,3 +57,3 @@ | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Fix up kv feature activation by @KodrAus in https://github.com/rust-lang/log/pull/659 | ||
@@ -47,3 +66,3 @@ | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Fix some typos by @Kleinmarb in https://github.com/rust-lang/log/pull/637 | ||
@@ -59,3 +78,3 @@ * Add logforth to implementation by @tisonkun in https://github.com/rust-lang/log/pull/638 | ||
| ## New Contributors | ||
| ### New Contributors | ||
| * @Kleinmarb made their first contribution in https://github.com/rust-lang/log/pull/637 | ||
@@ -73,3 +92,3 @@ * @tisonkun made their first contribution in https://github.com/rust-lang/log/pull/638 | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Add some clarifications to the library docs by @KodrAus in https://github.com/rust-lang/log/pull/620 | ||
@@ -85,3 +104,3 @@ * Add links to `colog` crate by @chrivers in https://github.com/rust-lang/log/pull/621 | ||
| ## New Contributors | ||
| ### New Contributors | ||
| * @chrivers made their first contribution in https://github.com/rust-lang/log/pull/621 | ||
@@ -95,3 +114,3 @@ * @DIvkov575 made their first contribution in https://github.com/rust-lang/log/pull/619 | ||
| ## What's Changed | ||
| ### What's Changed | ||
| * Minor clippy nits by @nyurik in https://github.com/rust-lang/log/pull/578 | ||
@@ -116,3 +135,3 @@ * Simplify Display impl by @nyurik in https://github.com/rust-lang/log/pull/579 | ||
| ## New Contributors | ||
| ### New Contributors | ||
| * @nyurik made their first contribution in https://github.com/rust-lang/log/pull/578 | ||
@@ -371,3 +390,4 @@ * @dimo414 made their first contribution in https://github.com/rust-lang/log/pull/590 | ||
| [Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.27...HEAD | ||
| [Unreleased]: https://github.com/rust-lang-nursery/log/compare/0.4.28...HEAD | ||
| [0.4.28]: https://github.com/rust-lang/log/compare/0.4.27...0.4.28 | ||
| [0.4.27]: https://github.com/rust-lang/log/compare/0.4.26...0.4.27 | ||
@@ -374,0 +394,0 @@ [0.4.26]: https://github.com/rust-lang/log/compare/0.4.25...0.4.26 |
+1
-1
@@ -21,3 +21,3 @@ log | ||
| `1.60.0+` | ||
| `1.61.0+` | ||
@@ -24,0 +24,0 @@ This version is explicitly tested in CI and may be bumped in any release as needed. Maintaining compatibility with older compilers is a priority though, so the bar for bumping the minimum supported version is set very high. Any changes to the supported minimum version will be called out in the release notes. |
+1
-1
@@ -228,3 +228,3 @@ //! Structured logging. | ||
| //! # use log::kv::Key; | ||
| //! # #[derive(Debug)] | ||
| //! #[derive(Debug)] | ||
| //! struct Data { | ||
@@ -231,0 +231,0 @@ //! a: i32, |
+2
-2
@@ -452,3 +452,3 @@ //! Structured values. | ||
| /// | ||
| /// Also see [`Value`'s documentation on seralization]. Value visitors are a simple alternative | ||
| /// Also see [`Value`'s documentation on serialization]. Value visitors are a simple alternative | ||
| /// to a more fully-featured serialization framework like `serde` or `sval`. A value visitor | ||
@@ -462,3 +462,3 @@ /// can differentiate primitive types through methods like [`VisitValue::visit_bool`] and | ||
| /// | ||
| /// [`Value`'s documentation on seralization]: Value#serialization | ||
| /// [`Value`'s documentation on serialization]: Value#serialization | ||
| pub trait VisitValue<'v> { | ||
@@ -465,0 +465,0 @@ /// Visit a `Value`. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display