jattac.libs.logger
1.1.0-beta05
dotnet add package jattac.libs.logger --version 1.1.0-beta05
NuGet\Install-Package jattac.libs.logger -Version 1.1.0-beta05
<PackageReference Include="jattac.libs.logger" Version="1.1.0-beta05" />
paket add jattac.libs.logger --version 1.1.0-beta05
#r "nuget: jattac.libs.logger, 1.1.0-beta05"
// Install jattac.libs.logger as a Cake Addin #addin nuget:?package=jattac.libs.logger&version=1.1.0-beta05&prerelease // Install jattac.libs.logger as a Cake Tool #tool nuget:?package=jattac.libs.logger&version=1.1.0-beta05&prerelease
Jattac Logging Library
This basic yet extensible library build primarily to log exceptions.
Overview
It comes with two inbuilt log targets
- Console Logger Logs to the console.
- 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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. 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. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 is compatible. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.8
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 7.0.3)
-
.NETStandard 2.0
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 7.0.3)
-
net6.0
- System.Net.Http (>= 4.3.4)
- System.Text.Json (>= 7.0.3)
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 |