pvNugsLoggerNc6Hybrid 6.0.0

dotnet add package pvNugsLoggerNc6Hybrid --version 6.0.0
                    
NuGet\Install-Package pvNugsLoggerNc6Hybrid -Version 6.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="pvNugsLoggerNc6Hybrid" Version="6.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="pvNugsLoggerNc6Hybrid" Version="6.0.0" />
                    
Directory.Packages.props
<PackageReference Include="pvNugsLoggerNc6Hybrid" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add pvNugsLoggerNc6Hybrid --version 6.0.0
                    
#r "nuget: pvNugsLoggerNc6Hybrid, 6.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.
#:package pvNugsLoggerNc6Hybrid@6.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=pvNugsLoggerNc6Hybrid&version=6.0.0
                    
Install as a Cake Addin
#tool nuget:?package=pvNugsLoggerNc6Hybrid&version=6.0.0
                    
Install as a Cake Tool

๐Ÿšฆ HybridLoggerService for .NET

A flexible, dependency-injected hybrid logger for .NET applications. The HybridLoggerService aggregates multiple log writers (console, file, SQL, etc.) and routes log messages to all configured destinations. Designed for extensibility, testability, and seamless integration with Microsoft.Extensions.DependencyInjection.

โœจ Features

  • Aggregate Multiple Log Writers โ€“ Console, file, SQL, and more
  • Configurable โ€“ Set minimum log level and writer options via config or code
  • Async Logging API โ€“ Non-blocking, scalable logging
  • Dependency Injection Ready โ€“ Integrates with .NET DI
  • Easily Extensible โ€“ Add custom log writers

๐Ÿ“ฆ Installation

dotnet add package pvNugsLoggerNc6Hybrid

or

Install-Package pvNugsLoggerNc6Hybrid

โšก Quick Start

1๏ธโƒฃ Configure Logging

Add logger settings to your configuration (e.g., appsettings.json):

{
  "PvNugsLoggerConfig": {
    "MinLogLevel": "trace"
  }
}

2๏ธโƒฃ Register Services

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using pvNugsLoggerNc6Abstractions;
using pvNugsLoggerNc6Hybrid;

var inMemSettings = new Dictionary<string, string>
{
    { "PvNugsLoggerConfig:MinLogLevel", "trace" }
    // Add other log writer settings as needed
};
var config = new ConfigurationBuilder()
    .AddInMemoryCollection(inMemSettings)
    .Build();

var services = new ServiceCollection();
services.TryAddPvNugsHybridLogger(config);
// Register other log writers as needed (console, file, SQL, etc.)

var sp = services.BuildServiceProvider();
var logger = sp.GetRequiredService<ILoggerService>();

3๏ธโƒฃ Log Messages

await logger.LogAsync("Hello World from HybridLogger!", SeverityEnu.Trace);

๐Ÿงช Integration Test Example

A real integration test console using HybridLoggerService with multiple log writers and configuration:

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using pvNugsCsProviderNc6MsSql;
using pvNugsLoggerNc6Abstractions;
using pvNugsLoggerNc6Hybrid;
using pvNugsLoggerNc6MsSql;
using pvNugsLoggerNc6Seri;

Console.WriteLine("Integration console for pvNugsLoggerNc6Hybrid");

var inMemSettings = new Dictionary<string, string>
{
    // SERILOG
    { "PvNugsLoggerConfig:MinLogLevel", "trace" },
    // CS PROVIDER in Config mode
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Name", "LoggingDb" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Mode", "Config" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Server", "Localhost" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Schema", "dbo" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Database", "IntTestingDb" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:Port", "1433" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:TimeoutInSeconds", "300" },
    { "PvNugsCsProviderMsSqlConfig:Rows:0:UseIntegratedSecurity", "true" },
    // MS SQL LOG WRITER CONFIG
    { "PvNugsMsSqlLogWriterConfig:ConnectionStringName", "LoggingDb" },
    { "PvNugsMsSqlLogWriterConfig:DefaultRetentionPeriodForTrace", "00:00:01" },
};

var config = new ConfigurationBuilder()
    .AddInMemoryCollection(inMemSettings!)
    .Build();

var services = new ServiceCollection();

services.TryAddPvNugsLoggerSeriService(config);
services.TryAddPvNugsCsProviderMsSql(config);
services.TryAddPvNugsMsSqlLogger(config);
services.TryAddPvNugsHybridLogger(config);

var sp = services.BuildServiceProvider();
var cLogger = sp.GetRequiredService<IConsoleLoggerService>();
var hLogger = sp.GetRequiredService<ILoggerService>();
var sLogger = sp.GetRequiredService<IMsSqlLoggerService>();

await cLogger.LogAsync("Logging to both the console and the db ", SeverityEnu.Trace);
await hLogger.LogAsync("Hello World", SeverityEnu.Trace);
await cLogger.LogAsync("Done", SeverityEnu.Trace);

โš™๏ธ Configuration

  • Configure minimum log level and log writer options via configuration.
  • Register any combination of log writers (console, file, SQL, etc.) before calling TryAddPvNugsHybridLogger.
  • The hybrid logger will automatically aggregate all registered log writers.

๐Ÿ—๏ธ Architecture

  • pvNugsLoggerNc6Abstractions โ€“ Core interfaces and base functionality
  • pvNugsLoggerNc6Hybrid โ€“ Hybrid logger (this package)
  • pvNugsLoggerNc6Console, pvNugsLoggerNc6MsSql, etc. โ€“ Pluggable log writers

๐Ÿงช Testing Support

  • Mockable interfaces for unit testing
  • Supports integration testing with in-memory or test log writers

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.


For more information, see the source repository.

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
6.0.0 321 11/14/2025

initial