Skip to content

Releases: Abc-Arbitrage/ZeroLog

v2.2.0

26 Jul 16:04
Compare
Choose a tag to compare

New features

  • Added a LogManager.Flush method, which can be useful in benchmarks
  • Added custom TimeProvider support in the configuration (#62, requires .NET 8)
  • Added %localDate and %localTime placeholders (#64)

Fixes

  • Fixed LogManager.RegisterAllEnumsFrom to be safe to use with assemblies containing invalid types
  • Fixed enum support on .NET 6 under Linux

v2.1.1

11 Oct 15:13
Compare
Choose a tag to compare
  • Fixed a race condition on shutdown where the last messages could be skipped

v2.1.0

09 Feb 17:19
Compare
Choose a tag to compare

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

v2.0.1

16 Dec 09:41
Compare
Choose a tag to compare
  • Added an option to use a background thread for appender execution (#58 by @Donis-)
  • Added a net7.0 target (#47)

v2.0.0

03 Aug 13:11
Compare
Choose a tag to compare

Rewrite for .NET 6

ZeroLog has been entirely rewritten to take advantage of new APIs in .NET 6 and new features of C# 10. Therefore, v2 only works on .NET 6 and above. A .NET Standard 2.0 target is provided to enable logging from libraries, but the main project needs to target .NET 6.

The surface API has been redesigned, but migration from v1 should still be straightforward (even though repetitive work is required).

See the readme file for more detailed information, and #44 for implementation notes.

Major changes

  • InfoFormat (and similar) methods have been removed, they are replaced by the new interpolated string handlers feature of C# 10, which means the following code:
    _log.Info($"Hello {World()}!");
    is now equivalent to:
    if (_log.IsInfoEnabled)
    {
        _log.Info()
            .Append("Hello ")
            .Append(World())
            .Append("!")
            .Log();
    }
  • The ILogEvent interface has been removed, it's replaced by the LogMessage class, in order to remove slower interface calls.
  • The ILog interface has been removed, it's replaced by the Log class, for the same reason.
  • Appenders have been entirely redesinged, and the StringFormatter library has been replaced with built-in .NET 6 formatting features.
  • ASCII values have been replaced with UTF-8.
  • External JSON configuration has been removed. The library is now configured in code. Live configuration updates are possible (but allocate).
  • The library now includes Roslyn analyzers that check for correct usage, and a new code fix for migration to the new syntax. See #45.

v1.6.1

23 Dec 11:02
Compare
Choose a tag to compare
  • Added AppendKeyValueAscii methods to the ILogEvent interface (#43)

v1.6.0

03 Dec 13:54
Compare
Choose a tag to compare
  • Added structured logging feature with AppendKeyValue (#40, #41)
  • Added support for %{field} syntax in prefix patterns (in addition to %field)
  • Added file open/close hooks to DateAndSizeRollingFileAppender
  • Log thread name instead of id when available

v1.5.0

09 Jul 12:44
Compare
Choose a tag to compare
  • Updated dependencies: replaced Jil with Newtonsoft.Json (#39)
  • Added ReadOnlySpan<byte> and ReadOnlySpan<char> overloads to AppendAsciiString (#37)

v1.4.3

28 Feb 13:28
Compare
Choose a tag to compare
  • Added nullable reference types annotations (#36)
  • Fixed a NullReferenceException which happened when using the default constructor of ConsoleAppender

v1.4.2

23 Sep 13:27
Compare
Choose a tag to compare
  • Added support for specifying an appender type with an assembly-qualified name - #35