jattac.libs.logger 1.0.0-beta03

This is a prerelease version of jattac.libs.logger.
There is a newer version of this package available.
See the version list below for details.
dotnet add package jattac.libs.logger --version 1.0.0-beta03                
NuGet\Install-Package jattac.libs.logger -Version 1.0.0-beta03                
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="jattac.libs.logger" Version="1.0.0-beta03" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add jattac.libs.logger --version 1.0.0-beta03                
#r "nuget: jattac.libs.logger, 1.0.0-beta03"                
#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 jattac.libs.logger as a Cake Addin
#addin nuget:?package=jattac.libs.logger&version=1.0.0-beta03&prerelease

// Install jattac.libs.logger as a Cake Tool
#tool nuget:?package=jattac.libs.logger&version=1.0.0-beta03&prerelease                

Jattac Logging Library

This basic yet extensible library build primarily to log exceptions.

Overview

It comes with two inbuilt log targets

  1. Console Logger Logs to the console.
  2. Disk Logger Logs to disk, and automatically deletes any files older than 30 days.

Usage

Simplest way to to create a global static instance program's startup. The constructor expects a HashSet of all the log targets that events shall be written.

public partial class Program
{
    public static ErrorLogger ErrorLogger = new ErrorLogger(new HashSet<IErrorLogTarget>
    {
        new ConsoleErrorTarget(),
        new DiskErrorLogTarget()
    });
}

After setup, you may now use the logger in your code. E.g.

public void MyMethod()
{
    try
    {
        // Error prone code
    }
    catch(Exception e)
    {
        ErrorLogger.Log(e, "Error occured when running the error prone section of the method");
    }
}

Extending The Library

If you wish to log to additional targets, then simply create a class that implements the interface

    public interface IErrorLogTarget
    {
        Task LogAsync(RichException richException);
    }

Which only requires single async method that receives a single argument with the exception information.

After creating your class then, you can include it in the log targets during instantiation of the ErrorLogger

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

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.1.0-beta05 94 3/11/2024
1.1.0-beta04 202 2/1/2024
1.1.0-beta03 100 1/26/2024
1.1.0-beta02 90 1/25/2024
1.1.0-beta01 96 1/25/2024
1.0.0 238 12/21/2023
1.0.0-beta05 126 8/30/2023
1.0.0-beta04 132 6/17/2023
1.0.0-beta03 117 6/11/2023
1.0.0-beta02 110 6/11/2023
1.0.0-beta01 112 6/10/2023