Gleeman.EffectiveLogger.PostgreSQL 2.0.6

dotnet add package Gleeman.EffectiveLogger.PostgreSQL --version 2.0.6                
NuGet\Install-Package Gleeman.EffectiveLogger.PostgreSQL -Version 2.0.6                
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="Gleeman.EffectiveLogger.PostgreSQL" Version="2.0.6" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Gleeman.EffectiveLogger.PostgreSQL --version 2.0.6                
#r "nuget: Gleeman.EffectiveLogger.PostgreSQL, 2.0.6"                
#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 Gleeman.EffectiveLogger.PostgreSQL as a Cake Addin
#addin nuget:?package=Gleeman.EffectiveLogger.PostgreSQL&version=2.0.6

// Install Gleeman.EffectiveLogger.PostgreSQL as a Cake Tool
#tool nuget:?package=Gleeman.EffectiveLogger.PostgreSQL&version=2.0.6                

Gleeman Effective Logger

SQLite

Install packages

dotnet CLI

dotnet add package Gleeman.EffectiveLogger --version 2.0.6
dotnet add package Gleeman.EffectiveLogger.SQLite --version 2.0.5
Program.cs
using Gleeman.EffectiveLogger.SQLite.Configurations;
builder.Services.AddSQLiteLog(options =>
{
    options.ConnectionString = "Connection string is here";
    options.WriteToFile = true;
    options.WriteToConsole = true;
    options.FilePath = "File path is here";
    options.FileName = "File name is here";
    options.MigrationAssembly = Assembly.GetExecutingAssembly();
});

<hr>

MSSQLServer

Install packages

dotnet CLI

dotnet add package Gleeman.EffectiveLogger --version 2.0.6
dotnet add package Gleeman.EffectiveLogger.MSSqlServer --version 2.0.5
Program.cs
using Gleeman.EffectiveLogger.MSSqlServer.Configurations;
builder.Services.AddMSSqlServerLog(options =>
{
    options.ConnectionString = "Connection string is here";
    options.WriteToFile = true;
    options.WriteToConsole = true;
    options.FilePath = "File path is here";
    options.FileName = "File name is here";
    options.MigrationAssembly = Assembly.GetExecutingAssembly();
});

<hr>

MySQL

Install packages

dotnet CLI

dotnet add package Gleeman.EffectiveLogger --version 2.0.6
dotnet add package Gleeman.EffectiveLogger.MySQL --version 2.0.5
Program.cs
using Gleeman.EffectiveLogger.MySQL.Configurations;
builder.Services.AddMySqlLog(options =>
{
    options.ConnectionString = "Connection string is here";
    options.WriteToFile = true;
    options.WriteToConsole = true;
    options.FilePath = "File path is here";
    options.FileName = "File name is here";
    options.MigrationAssembly = Assembly.GetExecutingAssembly();
});

<hr>

PostgreSQL

Install packages

dotnet CLI

dotnet add package Gleeman.EffectiveLogger --version 2.0.6
dotnet add package Gleeman.EffectiveLogger.PostgreSQL --version 2.0.5
Program.cs
using Gleeman.EffectiveLogger.PostgreSQL.Configurations;
builder.Services.AddPostgreSqlLog(options =>
{
    options.ConnectionString = "Connection string is here";
    options.WriteToFile = true;
    options.WriteToConsole = true;
    options.FilePath = "File path is here";
    options.FileName = "File name is here";
    options.MigrationAssembly = Assembly.GetExecutingAssembly();
});

<hr>

USAGE

public class LoggingMiddleware : IMiddleware
{
    private readonly IEffectiveLog<LoggingMiddleware> _log;

    public LoggingMiddleware(IEffectiveLog<LoggingMiddleware> log)
    {
        _log = log;
    }

    public async Task InvokeAsync(HttpContext context, RequestDelegate next)
    {
        try
        {
            _log.Information($"{context.Request.Method} - {context.Request.Path} - {context.Response.StatusCode}");
            _log.Debug($"{context.Request.Method} - {context.Request.Path} - {context.Response.StatusCode}");
            _log.Fail($"{context.Request.Method} - {context.Request.Path} - {context.Response.StatusCode}");
            _log.Warning($"{context.Request.Method} - {context.Request.Path} - {context.Response.StatusCode}");

            await next.Invoke(context);
        }
        catch (Exception ex)
        {
           _log.Fail($"{context.Request.Method} - {context.Request.Path} - {context.Response.StatusCode} - {ex.Message}");
        }
    }
}

Console Screen

Console

File Screen

File

Database Screen

Database

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. 
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
2.0.6 132 2/2/2024
2.0.5 139 9/29/2023
2.0.1 137 9/18/2023