SimpleLog4.NET
2.3.0.9
Please use the most recent version visible on Nuget, old versions are hidden but can still be downloaded indirectly.
dotnet add package SimpleLog4.NET --version 2.3.0.9
NuGet\Install-Package SimpleLog4.NET -Version 2.3.0.9
<PackageReference Include="SimpleLog4.NET" Version="2.3.0.9" />
paket add SimpleLog4.NET --version 2.3.0.9
#r "nuget: SimpleLog4.NET, 2.3.0.9"
// Install SimpleLog4.NET as a Cake Addin #addin nuget:?package=SimpleLog4.NET&version=2.3.0.9 // Install SimpleLog4.NET as a Cake Tool #tool nuget:?package=SimpleLog4.NET&version=2.3.0.9
Fast Non-Blocking Zero Allocation Thread Safe Logger for .NET Standard and Greater
All formatting and logging is done in a different thread.
Creating a Simple Log
using SimpleLog4.NET;
Create a new SimpleLog
with SimpleLogLevel.Information
SimpleLog Log = new SimpleLog(@"C:\test.txt", logLevel: SimpleLogLevel.Information);
Create a new SimpleLog
with SimpleLogLevel.Error
that also logs to Console
SimpleLog Log = new SimpleLog(@"C:\loglevelError.txt", true);
Create a new SimpleLog
and change the DateFormat
SimpleLog Log = new SimpleLog(@"C:\test.txt", dateFormat: "MM/dd/yyyy HH:mm:ss:fff");
Create a new SimpleLog
and change the IFormatProvider
SimpleLog Log = new SimpleLog(@"C:\test.txt", formatProvider: CultureInfo.InvariantCulture);
Write to the Log
Log.Information("Some Information");
Log.Warning("Some Warning");
Log.Error("Some Error");
Log.Exception(exception); // Exception
Log.WriteExceptionDirect(unhandledExceptionHandlerException); // Skip Queue
Output
Normal Output
[05/06/24 18:19:19:170][Info] Updated Exchange Information for [2617] symbols
[05/06/24 18:19:19:170][Info] Loaded [11] Stored Quotes from file
[05/06/24 18:19:19:170][Info] Loaded [0] Alerts from file
[05/06/24 18:19:19:372][Info] Loaded [405] Orders from file
[05/06/24 18:19:19:950][Info] Loaded [5782] Orders from file
[05/06/24 18:19:20:090][Info] Loaded [555] Orders from file
[05/06/24 18:19:20:090][Info] Loaded [71] Orders from file
[05/06/24 18:19:20:108][Info] Loaded [16] Orders from file
[05/06/24 18:19:20:123][Info] Got new Exchange Information from Server..
[05/06/24 18:19:20:123][Info] Updated Exchange Information for [2617] symbols
Single Exception Example
[05/06/24 17:00:27:383][Critical] Test Critical
[05/06/24 17:00:27:383][Exception]
System.ArgumentException | HRESULT: -2147024809
Message: Invalid Argument
Stack Trace:
at TestApp.MainContext.TestAll() in C:\Project\Base\MainContext.cs:line 72
[05/06/24 17:00:27:383][FATAL] Test Fatal
Aggregate Exception Example
[05/06/24 17:00:27:383][Critical] Test Critical
[05/06/24 17:00:27:383][Exception]
System.AggregateException | HRESULT: -2146233088
Message: One or more errors occurred.
Stack Trace:
at TestApp.MainContext.TestAll() in C:\Project\Base\MainContext.cs:line 99
--------
System.ArgumentException | HRESULT: -2147024809
Message: Invalid Argument
Stack Trace:
at TestApp.MainContext.TestAll() in C:\Project\Base\MainContext.cs:line 72
--------
System.ArgumentOutOfRangeException | HRESULT: -2146233086
Message: Count Must be greater than 5
Parameter name: exampleField
Stack Trace:
at TestApp.MainContext.TestAll() in C:\Project\Base\MainContext.cs:line 81
--------
System.ArgumentNullException | HRESULT: -2147467261
Message: Count can not be null
Parameter name: exampleField
Stack Trace:
at TestApp.MainContext.TestAll() in C:\Project\Base\MainContext.cs:line 90
--------
[05/06/24 17:00:27:383][FATAL] Test Fatal
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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. |
-
.NETStandard 2.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 |
---|
Add support for IFormatProvider
The default IFormatProvider is CultureInfo.InvariantCulture
Improve Exception Handling
Embedded symbols
Optimizations