Easy-Log
2.0.0
See the version list below for details.
dotnet add package Easy-Log --version 2.0.0
NuGet\Install-Package Easy-Log -Version 2.0.0
<PackageReference Include="Easy-Log" Version="2.0.0" />
paket add Easy-Log --version 2.0.0
#r "nuget: Easy-Log, 2.0.0"
// Install Easy-Log as a Cake Addin #addin nuget:?package=Easy-Log&version=2.0.0 // Install Easy-Log as a Cake Tool #tool nuget:?package=Easy-Log&version=2.0.0
<h1 align="center"> EasyLog </h1> <p align="center"> A simple and user-friendly logging system for .NET projects. </p>
<img src="https://i.imgur.com/NKhyA4h.png" align="middle">
Installation
Install Easy-Log in your project using NuGet Package Manager Console:
dotnet add package Easy-Log
Getting Started
You can use the global instance Log
or create your own instance with custom options.
var options = new LoggerOptions
{
ConsoleLogging = true, // Log to console
ShowDateAndTime = true, // Show Date and time with the log prefix
FileLogging = true, // Allow log to file
FileOutputPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "App.log") // File output path
};
Logger log = new Logger(options);
If you are using the global instance, set options like this:
Log.SetOptions(options);
Log Types
Easy-Log supports flexible log types. You can create your own by implementing the ILogType
interface. Here's an example:
public class Verbose : ILogType
{
public string Prefix => "VERBOSE"; // Set log prefix
public Color PrefixColor => Color.Gray; // Set prefix color
public Color ArgColor => Color.Gray; // Set args color
}
Logging
To log messages, use the Write
or WriteLine
functions. For logging exceptions, use LogException
.
/* structure */
instance.WriteLine<ILogType>(string, args)
instance.Write<ILogType>(string, args)
Log.WriteLine<Debug>("Hello World ARG 0: {} ARG 2: {}", 419, 500);
Log.WriteLine<Info>("Hello World ARG 0: {}", 613);
Log.WriteLine<Warning>("Hello World ARG 0: {}", 74);
Log.WriteLine<Error>("Hello World ARG 0: {}", 42);
try
{
List<int> list = new List<int>();
var item = list[10];
}
catch (Exception e)
{
Log.LogException(e);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- Pastel (>= 4.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Whole project rewrite see sample project for example how to use