Skip to content

Releases: SpriteOvO/spdlog-rs

v0.5.2

19 Dec 22:36

Choose a tag to compare

Changelog

  • Fix kv argument in logging macros not accepting references. Values are now constructed using ValueBag::from instead of ValueBag::capture. (PR #109)
  • Introduce AtomicLevelFilter to replace atomic::Atomic<LevelFilter>, which has undefined behavior. (PR #110)
  • Flush sinks on program exit with a special method Sink::flush_on_exit. (PR #102, thanks @tisonkun)
  • Add a builder for FullFormatter that allows configuring the presence of each field. (PRs #108 #114)
  • Allow StdStreamSink to write to stdout and stderr via print macros. It is useful if you want the logs to be captured by cargo test and cargo bench. (PR #106, issue #105)
  • Allow setting up filter for records from log crate via LogCrateProxy::set_filter method. (PR #111)
  • Add a shorthand method build_arc to all sink builder structs. (PR #107)
  • Add a public Level::count method.
  • Deprecate AsyncPoolSinkBuilder::formatter method. AsyncPoolSink does not have its own formatter, this method has no effect and was added by accident.
  • Add justfile to repository.
  • Bump MSRV to 1.71.
  • Documentation improvements:
    • Builder methods documentation now describes their default values.
    • Default values for SinkProp::default are now documented.
    • Update documentation of StringBuf.
    • Enable Rustdoc examples scraping on docs.rs.

v0.5.1

10 Oct 11:08

Choose a tag to compare

Changes

  • Bound Error::Downstream implements Send + Sync.

v0.5.0

02 Oct 20:08

Choose a tag to compare

Highlights / New Features

  • Structured logging supports. (issue #70, PR #77)
  • A new named optional parameter kv is accepted in logging macros for recording with structured key-value pairs.
    info!("program started", kv: { pid = std::process::id() });
  • A new pattern placeholder {kv} is added to pattern macros for writing out structured key-value pairs.
    pattern!("{datetime} {^{level}} {payload} {{ {kv} }}{eol}")
  • Access key-value pairs in records via a new method Record::key_values.
  • The named optional parameters in logging macros are allowed to be placed in arbitrary order.
    info!(logger: my_app, kv: { a = 1 }, "1 + a = {}", 2); // OK
    info!(logger: my_app, "1 + a = {}", 2, kv: { a = 1 }); // OK
    info!("1 + a = {}", 2, logger: my_app, kv: { a = 1 }); // OK
    info!(kv: { a = 1 }, "1 + a = {}", 2, logger: my_app); // OK
    info!(logger: my_app, "1 + a = {}", kv: { a = 1 }, 2); // Error
  • MSRV (minimum supported Rust version) is bumped to v1.66.1.
  • A new sink AndroidSink allows writing out logs to Android NDK log framework. (issue #96, PR #97)
  • JournaldSink passes an additional TID field to journald.
  • Allow configuring the capacity of BufWriter for file sinks via new methods {FileSinkBuilder,RotatingFileSinkBuilder}::capacity.
  • Allow passing a runtime level value to log! macro.
  • Use a semantically non-zero type for ThreadPoolBuilder, InvalidArgumentError::ThreadPoolCapacity is marked as deprecated. (thanks @tisonkun, #94).
  • Some implicit dependencies are no longer exposed as public enabled feature gates.
  • Replace spin locks with std locks (#92).
  • Add an error variant Downstream(Box<dyn std::error::Error> for downstream crates.
  • Mark swap_default_logger function as #[must_use].
  • Fix runtime_pattern! macro requiring explicit spdlog-internal dependency.
  • Benchmarking code is excluded from crates.io releases to reduce package size.
  • Fix typo in documentation. (thanks @felixonmars, #100)

Migrating from v0.4

v0.5 made some breaking changes for better interaction of downstream crates with spdlog-rs.

  • Methods Sink::{level_filter,set_level_filter,set_formatter,set_error_handler} are moved to a new trait SinkPropAccess, and trait Sink inherits it. (issue #71, PR #93)
    If you are implementing your own sink, you may want to define a field with type SinkProp within your sink and then implement the new trait GetSinkProp for your sink. This will make your sink automatically get trait SinkPropAccess implemented.
  • For methods {set_,}formatter in Logger and sink builders, an Into<Foramtter> is now accepted instead of a Box<dyn Formatter>.
  • ErrorHandler is no longer used with Option, to represent an empty ErrorHandler, use ErrorHandler::default(). This allows downstream crates to be able to call the internal default error handler. (#86)
  • ThreadPoolBuilder::capacity now accepts a NonZeroUsize instead of a usize.

v0.4.3

09 May 06:38

Choose a tag to compare

Changes

  • Implement get_current_tid_inner for Android. (#90)
  • Fix outdated doc for ThreadPoolBuilder::capacity. (#89)

v0.4.2

30 Apr 22:57

Choose a tag to compare

Changes

  • Macro source_location_current! returns full qualified None.
  • Replace eprintln! with writeln! to avoid broken stdio panic. (#88)

v0.4.1

09 Feb 15:43

Choose a tag to compare

Changes

v0.4.0

07 Oct 22:46

Choose a tag to compare

Highlights / New Features

Improvements / Bug Fixes

  • MSRV (minimum supported Rust version) is bumped to v1.60.
  • Fixed AsyncPoolSink may lose the last logs and may panic. (PR #66)
  • Fallback logger name to the target from log crate if present. (PR #50, thank @Lancern)
  • Respect local timezone when rotating files by time point.
  • Several internal performance optimizations.

Breaking Changes

  • Formatter::clone_box is removed, now it requires all formatters to implement Clone. The inherited DynClone trait enables it to be cloned object-safely.
  • FmtExtraInfo{,Builder} has been replaced with FormatterContext, and Formatter::format now has a &mut FormatterContext argument instead of returning Result<FmtExtraInfo>.
  • All re-exported log items has been moved from module log_crate to re_export::log.
  • Method LevelFilter::compare is renamed to LevelFilter::test. The old method is still available, but has been marked as #[deprecated] and may be removed in a future release.
  • Box the RecordOwned in struct SendToChannelErrorDropped to avoid moving large structures on the stack.
  • Implementors of Sink::log are no longer required to call should_log to filter logs. Now spdlog-rs will always check first by calling should_log, and only call log when it returns true.
  • PatternContext now has 2 new lifetimes.

v0.3.13

11 Feb 16:29

Choose a tag to compare

Changes

  • Fixed a nightly error by checking active even if Condvar times out in PeriodicWorker (issue #60, PR #61)

v0.3.12

11 Oct 09:44

Choose a tag to compare

Changes

  • Fixed unnecessary rebuild caused by code generation. (issue #40, PR #41)

v0.3.11

06 Sep 14:20

Choose a tag to compare

Changes

  • Handle conditional compilation for getting TID on iOS. (issue #36, PR #37)

  • Improve testing code.