SimpleLog4.NET
2.0.0.4
Please use the most recent version visible on Nuget, old versions are hidden but can still be downloaded indirectly.
See the version list below for details.
dotnet add package SimpleLog4.NET --version 2.0.0.4
NuGet\Install-Package SimpleLog4.NET -Version 2.0.0.4
<PackageReference Include="SimpleLog4.NET" Version="2.0.0.4" />
paket add SimpleLog4.NET --version 2.0.0.4
#r "nuget: SimpleLog4.NET, 2.0.0.4"
// Install SimpleLog4.NET as a Cake Addin
#addin nuget:?package=SimpleLog4.NET&version=2.0.0.4
// Install SimpleLog4.NET as a Cake Tool
#tool nuget:?package=SimpleLog4.NET&version=2.0.0.4
A Zero Allocation Log that is designed to be Fast and Simple
The only work that is done in the calling thread is queuing the message, all formatting and actual logging is done in a separate thread.
using SimpleLog4.NET;
Create a new SimpleLog
with SimpleLogLevel.Information
SimpleLog Log = new(@"C:\test.txt", logLevel: SimpleLogLevel.Information);
Create a new SimpleLog
with SimpleLogLevel.Error
that also logs to Console
SimpleLog Log = new(@"C:\loglevelError.txt", true);
Create a new SimpleLog
and change the DateFormat
SimpleLog Log = new(@"C:\test.txt", dateFormat: "MM/dd/yyyy HH:mm:ss:fff");
Write to the Log
Log.Info("Info");
Log.Warning("Warning");
Log.Error("Message");
Log.Exception(ex);
Log.WriteExceptionDirect(ex); // Skip Queue
Nullable
SimpleLog
is Nullable
This means you can make the log null in release mode and skip the logging altogether
SimpleLog Log = new(@"C:\test.txt", logLevel: SimpleLogLevel.Information); // debug mode etc
SimpleLog Log = null; // in release mode
Log?.Debug("This message wouldn't even be read in Release Mode");
Example output
[04/24/22 23:48:11:446][Info] Loading Settings
[04/24/22 23:48:11:491][Info] Timer WatchDog Started Successfully..
[04/24/22 23:48:11:612][Info] Loaded Exchange Informaiton from File
[04/24/22 23:48:11:616][Info] Initialized Commands
[04/24/22 23:48:11:617][Info] Loaded Deleted Order List..
[04/24/22 23:48:11:630][Info] Loaded Stored Orders from File
[04/24/22 23:48:11:844][Info] Selected Mode: Spot
[04/24/22 23:48:13:387][Info] Updated Exchange Information..
[04/24/22 23:48:14:511][Info] BTNET Started Successfully
Example Exception
[04/19/22 19:40:31:272] BTNET Failed to Start, [Error] Exception: | Exception: Could not find file 'C:\BNET\notes.txt'.| Trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost)
at System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost)
at BTNET.VM.ViewModels.NotepadViewModel.LoadNotes() in C:\BinanceTrader.NET\VM\ViewModels\NotepadViewModel.cs:line 45
at BTNET.BVVM.MainContext..ctor() in C:\BinanceTrader.NET\BVVM\MainContext.cs:line 119| Inner:
Donate
Bitcoin: 1NXUg88UvRWYn1WTnikVNn2fbbEtuTeXzm
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 |
---|---|---|
2.3.0.18 | 81 | 5/6/2024 |
Zero Allocation Log
Remove SimpleLogger Class, use SimpleLog Class instead
Improvements to the Queue
The only thing done in the calling thread is queueing the work
No longer has any dependencies