Easy-Log 2.0.2

dotnet add package Easy-Log --version 2.0.2                
NuGet\Install-Package Easy-Log -Version 2.0.2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Easy-Log" Version="2.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Easy-Log --version 2.0.2                
#r "nuget: Easy-Log, 2.0.2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Easy-Log as a Cake Addin
#addin nuget:?package=Easy-Log&version=2.0.2

// Install Easy-Log as a Cake Tool
#tool nuget:?package=Easy-Log&version=2.0.2                

<h1 align="center"> EasyLog </h1> <p align="center"> Simple and easy to use logging system. </p>

<img src="https://i.imgur.com/fmZhWRU.png" align="middle">

How to use?

  • Install Easy-Log to your project from nuget dotnet add package Easy-Log
  • You can either use global instance Log or create your own
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 use global instance you can set options by calling

Log.SetOptions(options);

LogTypes

Easy-Log has flexible log types where you can create your own using ILogType interface

  • Here is 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 you can use Write or WriteLine function. If you want log Exception you can use LogException

/* structure */
instance.WriteLine<ILogType>(string, args)
instance.Write<ILogType>(string, args)

Log.WriteLine<Debug>("Processing data - ID: {} Status: {}", 419, "In Progress");
Log.WriteLine<Info>("Task completed successfully - ID: {}", 613);
Log.WriteLine<Warning>("Unexpected input detected - Code: {}", "ABC123");
Log.WriteLine<Error>("Critical error occurred - Code: {}", "X987");

try
{
    List<int> list = [];
    var item = list[10];
}
catch (Exception e)
{
    Log.LogException(e);
}
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.0.2 174 3/16/2024
2.0.1 135 2/27/2024
2.0.0 260 12/6/2023
1.0.5 462 4/21/2022
1.0.4 411 4/19/2022
1.0.3 469 2/5/2022
1.0.2 421 1/23/2022
1.0.1 441 1/22/2022
1.0.0 446 1/22/2022

Fixed color encodings being in the file log