Gleeman.EffectiveLogger 2.0.7

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

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

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 (4)

Showing the top 4 NuGet packages that depend on Gleeman.EffectiveLogger:

Package Downloads
Gleeman.EffectiveLogger.SQLite

Logging to SQLite database

Gleeman.EffectiveLogger.MSSqlServer

Logging to MSSqlServer database

Gleeman.EffectiveLogger.PostgreSQL

Logging to PostgreSql database

Gleeman.EffectiveLogger.MySQL

Logging to MySQL database

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.7 336 2/2/2024
2.0.6 675 10/16/2023
2.0.5 605 9/29/2023