Skip to content

v2.1.0

Compare
Choose a tag to compare
@ltrzesniewski ltrzesniewski released this 09 Feb 17:19
· 34 commits to master since this release

Formatting

  • Formattable prefix placeholders with the %{type:format} syntax, e.g. %{date:yyyy-MM-dd HH:mm:ss}
    • An integer format can be used on string placeholders to specify a minimum field length, e.g. %{logger:40}
    • %{level:pad} can be used to make log levels a constant length (alias for %{level:5})
  • New prefix placeholders:
    • %newline inserts a system-dependent newline
    • %{column:N} inserts padding until the column index N is reached
    • %loggerCompact inserts the logger name with a shortened namespace, e.g. Foo.Bar.Baz => FB.Baz
  • New Roslyn analyzer which validates constant prefix patterns at build-time
  • Added TextWriterAppender (use TextWriterAppender(Console.Out) in unit tests)
  • New APIs in LoggedKeyValue: ValueType, TryGetValue<T>

Unit testing

  • Added ZeroLogConfiguration CreateTestConfiguration() with suitable defaults for unit testing
  • Support for a synchronous appending strategy (on the current thread) for use in unit tests (AppendingStrategy setting)
  • Added LoggedMessage.Clone() to capture logged messages
  • Snapshot testing with Verify.ZeroLog

Configuration

  • Added new convenience APIs for configuration:
    • ZeroLogConfiguration.SetLogLevel
    • New LoggerConfiguration constructor overloads
    • New initializer syntax for adding Loggers to the collection: Loggers = { { NameA, LevelA }, { NameB, LevelB } }
  • Made the UseBackgroundThread setting obsolete: the worker thread is now always a background thread
  • Added a LogManager.Configuration property

Various

  • Added a pool exhaustion strategy which is allowed to allocate
  • Added support for DateTimeOffset
  • Don't flood "Pool exhausted" messages
  • Various optimizations and bug fixes