LothiumLogger 1.1.0
See the version list below for details.
dotnet add package LothiumLogger --version 1.1.0
NuGet\Install-Package LothiumLogger -Version 1.1.0
<PackageReference Include="LothiumLogger" Version="1.1.0" />
paket add LothiumLogger --version 1.1.0
#r "nuget: LothiumLogger, 1.1.0"
// Install LothiumLogger as a Cake Addin #addin nuget:?package=LothiumLogger&version=1.1.0 // Install LothiumLogger as a Cake Tool #tool nuget:?package=LothiumLogger&version=1.1.0
LothiumLgger
LothiumLogger is a simple easy Logger Library for .Net applications written entirely in C# for fun, it offers a basic and easy syntax and give flexybility to the final user.
For create a new Logger istance you will need to use the LoggerConfiguration class:
var logger = new LoggerConfiguration()
.WriteToConsole()
.WriteToFile(fileName: "Log", minimumLevel: LogLevel.Normal)
.WriteToFile(fileName: "Err_Log", restrictedToLevel: LogLevel.Err)
.Build();
After the creation of the new logger istance, there is 6 different methods to write a new log message:
// Defualt base message
logger.Write("Log Message");
// Debug message when testing code
logger.Debug("Debug Log Message");
// Info message
logger.Information("Info Log Message");
// Warning message
logger.Warning("Warn Log Message");
// Error message
logger.Error("Err Log Message");
// Fatal message
logger.Fatal("Fatal Log Message");
The library gave the user the ability to seraize an object inside the log message or a one or more property to keep track of real time changes. For serialize an object or a Property Name is required the Type Name likes this example:
Person person = new Person()
{
Name = "Andrea",
Surname = "Santinato",
Age = 25
};
logger.Information("Created Person: {@Person}", person);
logger.Information("Person Name: {@Name} {@Surname}", person);
logger.Information("Person Age: {@Age}", person);
For this methods to work the parameter's name must be equal to the object class's type, in this case the class name is 'Person'
If an error occured while executing the code and need to keep track of exception, the library offer the ability to serialize an exception object directly to the log message:
try
{
// Some Code Here...
throw new Exception("Test exception example!!");
}
catch (Exception exception)
{
// Log the exception
logger.Error(exception);
}
Getting started
You can install LothiumLogger directly from NuGet using the NuGet Manager inside Visual Studio or with this command:
dotnet add package LothiumLogger
Bug Reports
If you want to contribute to this project, you can send a pull request to the GitHub Repository and i'll be happy to add it to the project. In The feature i'll separate the Master Branch from the Develop Branch
I welcome any type of bug reports and suggestions through my GitHub Issue Tracker.
LothiumLogger is copyright © 2023 - Provided under the GNU General Public License v3.0.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | 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. |
-
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.
- Added New Object Serialization Options.
- Changes Logger Class Methods For More Options.