RockLib.Logging 2.0.0

A simple logging library.

This package was built from the source code at

Install-Package RockLib.Logging -Version 2.0.0
dotnet add package RockLib.Logging --version 2.0.0
<PackageReference Include="RockLib.Logging" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add RockLib.Logging --version 2.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

RockLib.Logging version 2.0.0

**Changes to ILogger interface**
- Add `LogProviders` property
 - The collection of log providers had been a private field of the Logger class; now it is exposed in the interface.
- Add `ErrorHandler` property
 - When set, it handles errors from log providers.
 - Can also be set using a delegate by calling the `SetErrorHandler` extension method for the `ILogger` interface.
- Add `ContextProviders` property
 - A collection of objects for customizing (e.g. adding extended properties to) outgoing logs before they are sent.
- Add `LogProcessor` property
 - Instead of the `Logger` class handling the processing of logs, either synchronously or asynchronously depending on the value of the `isSynchronous` constructor parameter, it delegates the main processing of logs to its log processor.
 - Can be set directly with an implementation of `ILogProcessor`, or by specifying the logger's processing mode - `Background`, `Synchronous`, or `FireAndForget`.
- Implement `IDisposable`
 - Previously, the `Logger` class implemented `IDisposable`, but not the `ILogger` interface.

**Changes to LoggerFactory**
- `LoggerFactory` is configuration-based instead of "configuration-based by default, otherwise able to specify collection of logger objects from which to choose from".
 - Has a `Configuration` property whose value determines what loggers the factory can produce.
 - The default configuration comes from the "RockLib.Logging" or "RockLib_Logging" section under `RockLib.Configuration.Config.Root`.
 - Can specify a custom configuration with the `SetConfiguration` method.
- Renames methods to be simpler and more explicit: `CreateFromConfig` -> `Create`; `GetInstance` -> `GetCached`
- Methods return `ILogger` instead of `Logger`
- Adds optional parameters to `LoggerFactory` methods
 - `defaultTypes`, `valueConverters`, and `resolver`
   - LoggerFactory uses the `RockLib.Configuration.ObjectFactory` library to actually create the `ILogger`.
- These values are used by the library to customize how the logger is created.
 - `reloadOnConfigChange`
   - The `RockLib.Configuration.ObjectFactory` library has the ability to create objects from configuration such that, when the configuration changes, the objects reload themselves automatically. `LoggerFactory` can use this ability.
- Default is `true`, meaning loggers will reload themselves when their configuration changes. Set to `false` if a config-reloading logger is not desired.

**Changes to LogEntry**
- Add new properties: correlationId, businessProcessId, and businessActivityId
 - These are also exposed as optional parameters in the logging extension methods.
- Make CallerInfo first-class property of LogEntry

**Changes to log providers**
- `FileLogProvider` synchronizes across all instances that use the same file
 - This means all instances of `FileLogProvider` that use the same file can write concurrently.
- `ConsoleLogProvider` can target either stdout or stderr

Version History

Version Downloads Last updated
2.0.0 5,996 4/25/2019
2.0.0-alpha11 156 4/19/2019
2.0.0-alpha10 148 4/5/2019
2.0.0-alpha09 69 3/27/2019
2.0.0-alpha08 71 3/26/2019
2.0.0-alpha07 58 3/21/2019
2.0.0-alpha06 218 3/4/2019
2.0.0-alpha05 61 3/1/2019
2.0.0-alpha04 67 2/28/2019
2.0.0-alpha03 1,364 1/4/2019
2.0.0-alpha02 99 1/3/2019
2.0.0-alpha01 90 10/22/2018
1.2.0 50,390 10/5/2018
1.1.0 24,837 8/3/2018
1.0.1 4,884 6/29/2018
1.0.0 2,956 6/19/2018
1.0.0-alpha08 258 5/24/2018