LothiumLogger 1.2.0

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

// Install LothiumLogger as a Cake Tool
#tool nuget:?package=LothiumLogger&version=1.2.0

LothiumLgger NuGet Version NuGet Downloads

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 instance you will need to use the LoggerConfiguration class:

var logger = new LoggerConfiguration()
    .AddConsoleSink()
    .AddFileSink(name: "Log", minimumLogLevel: LogLevel.Normal)
    .AddFileSink(name: "Err_Log", restrictedToLogLevel: LogLevel.Err)
    .Build();

After the creation of the new logger instance, 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: {@Person.Name} {@Person.Surname}", person);
logger.Information("Person Age: {@Person.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' When you need to serialize one or more object property, the library need a combination of the object's type name and the property name In the end the library can serialize an external independent variable passed to the methods:

string example = "Test Variable";
logger.Debug("Variable Value: {@example}", example);

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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.

Version Downloads Last updated
1.4.0 140 1/11/2024
1.3.0 114 9/7/2023
1.2.0 108 8/21/2023
1.1.0 110 8/18/2023
1.0.0 141 8/10/2023

Completely rewrite the library's core logic and methods for better performance and code rewrites.