EasyLogPlus 1.0.6.1
dotnet add package EasyLogPlus --version 1.0.6.1
NuGet\Install-Package EasyLogPlus -Version 1.0.6.1
<PackageReference Include="EasyLogPlus" Version="1.0.6.1" />
<PackageVersion Include="EasyLogPlus" Version="1.0.6.1" />
<PackageReference Include="EasyLogPlus" />
paket add EasyLogPlus --version 1.0.6.1
#r "nuget: EasyLogPlus, 1.0.6.1"
#addin nuget:?package=EasyLogPlus&version=1.0.6.1
#tool nuget:?package=EasyLogPlus&version=1.0.6.1
EasyLogPlus
A [relatively] simple .NET 6 logging library. Originally made by byte-0x74, extended by asoji.
What's different between this and the original repo?
- Uses .NET 6 instead of .NET Framework 4.x
- The text is more way readable [in my opinion]*
- Customizable severity level colors
- Added the whole Syslog Severity Level standardization [read about that here], cranking from 4 severity levels to 8.
- Uses your local timezone in logs instead of UTC timezone
- Switchable between
:
and=>
in logs, likeNOTICE: This is notice text!
orNOTICE => This is notice text!
usingcfg.UseColon
- Ability to have Critical-Emergency logs be logged in a seperate file through
cfg.SeperateCriticalLogs
- Probably a lot of breaking changes, but I plan on basically keeping this seperate from the original project.
Basically, I should've just made my own logger considering how much I changed, but eh, this fork works, and I'm pretty happy with it.
*- This is what the original looked like on my screen in Rider and oh no.
It looks a lot better like this now
How to use?
Installation
You have 2 ways:
- [as of 1.0.6.1], you can now just grab
EasyLogPlus
from NuGet, ordotnet add package EasyLogPlus
- Install EasyLogPlus from GitHub's NuGet Registry, instructions here, make sure the author is
asoji
Usage
- Add
using EasyLogPlus;
to the top, and then add
Logger log = new Logger();
Config cfg = new Config();
Customization Options
If you want customize settings add these, keeping in mind that this whole SetConfig()
is optional, and not required to run the application.
void SetConfig()
{
cfg.ShowDate = true; // If this is set to true, it will add date to the log
cfg.Console = true; // If this is set to true, it will print the log to Console too
cfg.SeperateCriticalLogs = true; // If this is set to true, it will print Critical-Emergency logs to a seperate log file
// ENTIRELY optional, just add and change if you want.
cfg.UseColon = true; // If set to true, uses `:` in logs instead of `=>`
cfg.LogPath = Environment.CurrentDirectory + $@"\Application.log"; // Sets where your Log saves and under what name
// Logger color customization
cfg.DebugText = ConsoleColor.Blue;
cfg.InfoText = System.Console.ForegroundColor;
cfg.NoticeText = ConsoleColor.Green;
cfg.WarningText = ConsoleColor.DarkYellow;
cfg.ErrorText = ConsoleColor.Red;
cfg.CriticalText = ConsoleColor.White;
cfg.AlertText = ConsoleColor.White;
cfg.EmergencyText = ConsoleColor.White;
cfg.DebugBackground = System.Console.BackgroundColor;
cfg.InfoBackground = System.Console.BackgroundColor;
cfg.NoticeBackground = System.Console.BackgroundColor;
cfg.WarningBackground = System.Console.BackgroundColor;
cfg.ErrorBackground = System.Console.BackgroundColor;
cfg.CriticalBackground = ConsoleColor.DarkRed;
cfg.AlertBackground = ConsoleColor.DarkBlue;
cfg.EmergencyBackground = ConsoleColor.DarkMagenta;
}
Then in your application main void add these, this is required.
log.cfg = cfg;
SetConfig();
log.InitLogger(); // Call this to init logger
Using Logs
- Debug Log
log.Debug("Hello from log, this is debug");
- Info Log
log.Info("Hello from log, this is info");
- Notice Log
log.Notice("Hello from log, this is notice");
- Warning Log
log.Warning("Hello from log, this is warning");
- Error Log
log.Error("Hello from log, this is error");
- Critical Log
log.Critical("Hello from log, this is critical")
- Alert Log
log.Alert("Hello from log, this is alert")
- Emergency Log
log.Emergency("Hello from log, this is emergency")
[terrible] Example
class Program {
static Logger log = new Logger();
static Config cfg = new Config();
static void SetConfig() {
cfg.LogPath = Environment.CurrentDirectory + @"\Application.log";
cfg.ShowDate = true;
cfg.Console = true;
cfg.SeperateCriticalLogs = true;
cfg.UseColon = false;
cfg.CriticalBackground = ConsoleColor.Cyan;
cfg.NoticeText = ConsoleColor.Magenta;
}
static void Main(string[] args) {
SetConfig();
log.cfg = cfg;
log.InitLogger();
try {
// do some random shit
} catch (ArgumentOutOfRangeException outOfRangeException) {
log.Critical("hey something is out of range?");
}
Console.ReadKey();
}
}
License
This project [well, fork] is MIT Licensed. Thank you byte-0x74/0x74 for making the original lib C:
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. 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. |
.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.
-
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.0.6.1 | 275 | 9/4/2022 |