Skip to content

v4.0.0

Latest

Choose a tag to compare

@adams85 adams85 released this 25 Nov 23:01

Please note that this version comes with a few minor breaking changes, so you may need to adjust your code when upgrading, especially if you're customizing the logging logic by extending the library's classes. You can find the detailed list of breaking changes below.

Improvements

  • Adds nullable reference type annotations. (This may be a source breaking change if your project is configured to use NRTs and your code tries to pass nullable values in parameters marked as non-nullable. Such errors, however, indicates that your code is incorrect and you need to revise it.)
  • Adds net9.0 and net10.0 to target frameworks.
  • On .NET 8+, automatically uses TimeProvider for getting timestamps if it is registered in the DI container. (You can revert to the original behavior by explicitly passing FileLoggerContext.Default to the AddFile and AddFileJson methods.)
  • For JSON structured logging, omits message from state if it is identical to the log message. (#34, #35)
  • Adds the JsonFileLogFormatOptions.ForJsonLines static factory method for creating options to emit JSON lines.
  • Allows overriding the timestamp provider logic without subclassing FileLoggerContext by introducing FileLoggerContext.WithTimestampProvider.
  • Enhances the extensibility of FileLogger by changing some additional fields from private to protected.
  • Makes the library assemblies localizable by moving error and diagnostic messages into resources.
  • Enables Source Link.
  • Enables deterministic (a.k.a. reproducible) build.
  • Minor performance improvements (primarily, eliminates some heap allocations to reduce GC pressure).
  • Revises and improves the documentation.

Bug fixes

  • Fixes the behavior of MinLevel so it does not act as an inclusion list. (This could be viewed as a behavioral breaking change, however the original behavior was never intended.) (#36)
  • Fixes the setters of RootPath and TextBuilderType so they no longer throw on null assignments but reset to default instead.

Breaking changes

  • Converts FileLogEntry to a value type and passes it around by reference (using the in modifier). This changes the signature of some overridable methods in FileLoggerProcessor.
  • Adds an extra parameter to JsonFileLogEntryTextBuilder.WriteState.
  • Adds an extra parameter to FileLogger.CreateLogEntry and FileLogger.CreateState.
  • Changes the name of the timestampGetter parameter to timestampProvider in the constructor of FileLogger.
  • Removes obsolete constructor from JsonFileLogEntryTextBuilder.