Easy-Log 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Easy-Log --version 2.0.1                
NuGet\Install-Package Easy-Log -Version 2.0.1                
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.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Easy-Log --version 2.0.1                
#r "nuget: Easy-Log, 2.0.1"                
#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.1

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

<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 171 3/16/2024
2.0.1 134 2/27/2024
2.0.0 257 12/6/2023
1.0.5 461 4/21/2022
1.0.4 408 4/19/2022
1.0.3 468 2/5/2022
1.0.2 420 1/23/2022
1.0.1 440 1/22/2022
1.0.0 445 1/22/2022

Made more memory efficient