BatchingLoggerProvider 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package BatchingLoggerProvider --version 1.0.0
NuGet\Install-Package BatchingLoggerProvider -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BatchingLoggerProvider" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BatchingLoggerProvider --version 1.0.0
#r "nuget: BatchingLoggerProvider, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BatchingLoggerProvider as a Cake Addin
#addin nuget:?package=BatchingLoggerProvider&version=1.0.0

// Install BatchingLoggerProvider as a Cake Tool
#tool nuget:?package=BatchingLoggerProvider&version=1.0.0

StructuredLoggerMessage

License Continuous Deployment NuGet

An abstract implementation of ILoggerProvider, from the .NET Extensions Logging Framework framework, for delivering log events, in batches, to a remote location.

Usage

Implementing a batching logger

Implementing your own batching logger provider involves the following:

  • Implementing the following abstract classes from this library -- BatchingLoggerProvider.BatchingLoggerProviderBuilderBase -- BatchingLoggerProvider.BatchingLoggerProviderBase -- BatchingLoggerProvider.Internal.BatchingLoggerBase -- BatchingLoggerProvider.Internal.BatchingLoggerManager
  • Implementing the following interfaces -- BatchingLoggerProvider.Internal.IBatchingLoggerPayloadManager
  • (Optionally) extending the following classes/interfaces -- BatchingLoggerProvider.Internal.BatchingLoggerEvent<TState> -- BatchingLoggerProvider.Internal.IBatchingLoggerEvent -- BatchingLoggerProvider.BatchingLoggerOptions
BatchingLoggerProviderBuilderBase

This class provides an abstract implementation of an ILoggingBuilder extension method, which adds your provider to a logging system, in the style of .AddConsole() or .AddDebug(). It builds an inversion-of-control container to house all of the dependencies needed by a BatchingLoggerProviderBase implementation, creates the provider, and registers it with the logging system.

BatchingLoggerProviderBase

This class is the entry point of a batching logger system. It implements the ILoggerProvider interface, and constructs ILogger instances for consumption by an application.

BatchingLoggerBase

This class implements the ILogger interface for a batching logger system. It is the primary API between the logging system, and the foreground application.

BatchingLoggerManager

This class is the core of the background management process, of a batching logger system. It runs continuously in the background, and manages when events are processed, in preparation for delivery to the appropriate remote location, and when such deliveries occur.

IBatchingLoggerPayloadManager

This is the primary API for implementing a batching logger system. Implementers should, with the help of an IBatchingLoggerEventChannel dependency, use this interface to implement logic for retrieving log events to be delivered, preparing data for delivery, and performing delivery operations. This is where implementers can also add custom logic for triggering when batched payloads get delivered.

BatchingLoggerEvent<TState> / IBatchingLoggerEvent

The IBatchingLoggerEvent allows the background management process to perform preparation work, without needing to use reflection to transition into a generic-type context, for each log event. That is, the manager can invoke non-generic operations that execute within the generic-type context of the log event object itself. It also allows implementers to extend both IBatchingLoggerEvent and BatchingLoggerEvent<TState> to include their own custom operations, which execute within the generic-type context of a log event object, without requiring the managers to transition into a generic-type context manually.

Essentially, if you want to assemble data for structured logging, you will want to extend both of these types to define your own operations upon the TState values of individual log events.

BatchingLoggerOptions

This class defines the core set of options controlling when delivery of batched payloads occurs. It includes the following options:

  • MaxDeliveryInterval -- This is the maximum amount of time that the manager will hold log events in memory, before assembling instructing the implementer to deliver all outstanding events to the remote.
  • MinDeliveryInterval -- This is the minimum amount of time that the manager will wait, between attempts to deliver payloads to the remote. Essentially, this is a rudimentary form of ratelimiting.

These options are automatically registered with the logging system, to be populated from whatever configuration sources are setup for the logging system. That is, these options serve as extensions to the core configuration system for logger providers. For example, within a standard appsettings.json configuration file, these settings can be configured as follows:

{
  "Logging": {
    "MyBatchingLogger": {
      "MaxDeliveryInterval": "00:00:10",
      "MinDeliveryInterval": "00:00:01",
      "LogLevel": {
        "Default": "Debug"
      }
    }
  }
}

Consumers implementing their own batching logger provider may extend this class, if they wish, to attach their own sets of options, to control the behavior of the system.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 432 8/25/2021
3.0.0 312 8/19/2021
2.0.0 308 8/19/2021
1.0.0 569 8/15/2021

Initial Release