Skip to content

Release version 0.2.0

Choose a tag to compare

@daboross daboross released this 02 Jan 01:03
· 328 commits to main since this release

This version reworks the public API in order to turn fern into a backend to the log crate.

API Changes:

  • Remove the local module, as the log crate now handles storing a global logger.
  • fern::Logger must now be Sync + Send
  • BoxedLogger and ArcLogger typedefs are removed, due to writing + Sync + Send no longer being required
  • Now everything just uses Box
  • Level is removed, in favor of using log::LogLevel and log::LogLevelFilter
  • LoggerConfig is renamed into DispatchConfig
  • Rename Error to LogError
    • Implement fmt::Display for LogError
  • A new Formatter type is added for formatting closures. It also now takes a &log::LogLocation parameters as well.
  • OutputConfig::Parent is renamed into OutputConfig::Child, this seems to make more sense, given that you can have any number of children
  • Logger::log() now takes (&str, &log::LogLevel, &log::LogLocation) instead of (&fern::Level, &str)
  • Add an IntoLog trait which DispatchConfig and OutputConfig implement (instead of having into_logger() on each of them.
  • Add an into_log() method to the IntoLog trait that turns a log configuration into a log::Log (as apposed to fern::Logger)
  • Rename IntoLog.into_logger() to IntoLog.into_fern_logger() in order to differentiate from the into_log() method.
  • Add a fern::init_global_logger() method which sets the global log crate logger from a log configuration
  • Add an InitError error which is used by init_global_logger() for either an IO error or log::SetLoggerError
  • Update everything to use the new io and path modules
  • Add a FileOptions option to OutputConfig which allows for specifying an OpenOptions for opening the log file with

Also:

  • The docs have been rewritten to be up to date with all the above changes
  • The code snippets in the docs are now all tested! This is instead of having no_test and not having fully workable code examples.
  • There is a new tests/lib.rs file which contains tests for initializing fern and log filtering with different log levels.