Releases: adams85/filelogger
Releases · adams85/filelogger
v4.0.0
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.0andnet10.0to target frameworks. - On .NET 8+, automatically uses
TimeProviderfor getting timestamps if it is registered in the DI container. (You can revert to the original behavior by explicitly passingFileLoggerContext.Defaultto theAddFileandAddFileJsonmethods.) - For JSON structured logging, omits message from state if it is identical to the log message. (#34, #35)
- Adds the
JsonFileLogFormatOptions.ForJsonLinesstatic factory method for creating options to emit JSON lines. - Allows overriding the timestamp provider logic without subclassing
FileLoggerContextby introducingFileLoggerContext.WithTimestampProvider. - Enhances the extensibility of
FileLoggerby changing some additional fields fromprivatetoprotected. - 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
MinLevelso 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
RootPathandTextBuilderTypeso they no longer throw onnullassignments but reset to default instead.
Breaking changes
- Converts
FileLogEntryto a value type and passes it around by reference (using theinmodifier). This changes the signature of some overridable methods inFileLoggerProcessor. - Adds an extra parameter to
JsonFileLogEntryTextBuilder.WriteState. - Adds an extra parameter to
FileLogger.CreateLogEntryandFileLogger.CreateState. - Changes the name of the
timestampGetterparameter totimestampProviderin the constructor ofFileLogger. - Removes obsolete constructor from
JsonFileLogEntryTextBuilder.