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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<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 | 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
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.
Fixed color encodings being in the file log