ChroniLog.Flusher.PostgreSql 1.0.7

dotnet add package ChroniLog.Flusher.PostgreSql --version 1.0.7
                    
NuGet\Install-Package ChroniLog.Flusher.PostgreSql -Version 1.0.7
                    
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="ChroniLog.Flusher.PostgreSql" Version="1.0.7" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ChroniLog.Flusher.PostgreSql" Version="1.0.7" />
                    
Directory.Packages.props
<PackageReference Include="ChroniLog.Flusher.PostgreSql" />
                    
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 ChroniLog.Flusher.PostgreSql --version 1.0.7
                    
#r "nuget: ChroniLog.Flusher.PostgreSql, 1.0.7"
                    
#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 ChroniLog.Flusher.PostgreSql@1.0.7
                    
#: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=ChroniLog.Flusher.PostgreSql&version=1.0.7
                    
Install as a Cake Addin
#tool nuget:?package=ChroniLog.Flusher.PostgreSql&version=1.0.7
                    
Install as a Cake Tool

<img src="https://raw.githubusercontent.com/sicilo/ChroniLog/master/ChroniLog.Core/logo.png" alt="ChroniLog Logo" width="150"/>

ChroniLog Flush PostgreSQL 🎯

Installation

Add the following NuGet packages to your project:

dotnet add package Npgsql
dotnet add package ChroniLog.Core
dotnet add package ChroniLog.Flusher.PostgreSql

Configuration

  1. Register appsettings.json configuration

    In the code below, you can see ChroniLogOptions, which is mandatory if you want to customize buffer and database table name options, and ConnectionOptions, which is just an example for the next steps about how to provide NpgsqlDataSource using dependency injection.

    {
        "Logging": {
            "LogLevel": {
                "Default": "Information",
                "Microsoft.AspNetCore": "Warning"
            }
        },
        "AllowedHosts": "*",
        "ConnectionOptions": {
          "Database":"Host=<your_host>;Port=<your_port>;Database=<your_db>;Username=<your_user>;Password=<your_pass>"
        },
        "ChroniLogOptions": {
            "BufferCapacity": 50,
            "BufferFlushInterval": 10,
            "TableName": "audit"
        }
    }
    
  2. Register NpgsqlDataSource with Dependency Injection

    //ConnectionOptions appSettings Model
     public class ConnectionOptions
     {
         public string Database { get; set; } = null!;
     }
    
    //Configure ConnectionOptions
     public class ConfigureConnectionOptions(IConfiguration configuration) : IConfigureOptions<ConnectionOptions>
     {
         public void Configure(ConnectionOptions options)
         {
             configuration.GetSection(nameof(ConnectionOptions)).Bind(options);
         }
     }
    
    //Configure ConnectionOptions
     public static class DatabaseExtensions
     {
         public static IServiceCollection AddDatabase(this IServiceCollection builder)
         {
             builder.ConfigureOptions<ConfigureConnectionOptions>();
    
                 builder.AddSingleton<NpgsqlDataSource>(serviceProvider =>
                 {
                     var options = serviceProvider.GetRequiredService<IOptions<ConnectionOptions>>().Value;
                     var npgsqlDataSourceBuilder = new NpgsqlDataSourceBuilder(options.Database);
                     return npgsqlDataSourceBuilder.Build();
                 });
    
             return builder;
         }
     }
    
    //Program.cs
     var builder = WebApplication.CreateBuilder(args);
     builder.Services.AddDatabase();
    
  3. Register AddNpgLog with Dependency Injection

    //Program.cs
     var builder = WebApplication.CreateBuilder(args);
     builder.Services.AddDatabase();
     builder.Logging.AddChroniLogFlushPostgreSql();
    

Notes

  • Npgsql provides PostgreSQL database handler.
  • ChroniLog.Core provides the core logging infrastructure.
  • ChroniLog.Flusher.PostgreSql is the PostgreSQL-specific implementation.
  • Ensure your PostgreSQL database and connection string are properly configured.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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
1.0.7 340 9/24/2025
1.0.6 311 9/19/2025
1.0.5 313 9/19/2025
1.0.4 318 9/18/2025
1.0.3 315 9/18/2025
1.0.2 317 9/18/2025
1.0.1 321 9/18/2025
1.0.0 339 9/16/2025