jattac.libs.logger 1.0.0-beta01

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

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.  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.
  • 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.2.0-beta05 225 5/23/2025
1.2.0-beta04 213 5/23/2025
1.2.0-beta03 209 5/23/2025
1.2.0-beta02 231 5/23/2025
1.2.0-beta01 188 5/23/2025
1.1.0-beta06 241 4/9/2025
1.1.0-beta05 429 3/11/2024
1.1.0-beta04 489 2/1/2024
1.1.0-beta03 197 1/26/2024
1.1.0-beta02 195 1/25/2024
1.1.0-beta01 193 1/25/2024
1.0.1 281 4/9/2025
1.0.0 393 12/21/2023
1.0.0-beta05 245 8/30/2023
1.0.0-beta04 281 6/17/2023
1.0.0-beta03 272 6/11/2023
1.0.0-beta02 264 6/11/2023
1.0.0-beta01 272 6/10/2023