LokiLogger 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package LokiLogger --version 2.0.2
                    
NuGet\Install-Package LokiLogger -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="LokiLogger" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LokiLogger" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="LokiLogger" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LokiLogger --version 2.0.2
                    
#r "nuget: LokiLogger, 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.
#addin nuget:?package=LokiLogger&version=2.0.2
                    
Install LokiLogger as a Cake Addin
#tool nuget:?package=LokiLogger&version=2.0.2
                    
Install LokiLogger as a Cake Tool

LokiLogger v2

Vendors Lock-In is a common Antipattern, Patterns like Dependency Injection try to remove these Antipatterns, but not all Platforms support DI like e.g. ASP Core. So usually a Wrapper/Interface is build, so it's easy to exchange e.g. the Loging Framework. Also some new nice Feature are not supported, like the CallerLineNumber to get the LineNumber in which a Method is called.

So you can build for every Project your on Logging Wrapper, or you can just use LokiLogger, which is basically the same.

Why it's much better than other Logger?

LokiLogger do not replace other Logger, it just build a wrapper around them, so you can use LokiLogger as your normal Logging Interface and define on Runtime which Framework you want to use (maybe you want to use more than one). Maybe you use an Email Notification on Fatal Errors, you can define this in LokiLogger.

Usage

More than simple just:

Loki.UpdateAdapter(new SerilogLoggerAdapter());


Loki.Verbose("Text");
Loki.Debug("Text");
Loki.Information("Text");
Loki.Warning("Text");
Loki.Error("Text");
Loki.Fatal("Text");


Architecture

The Libary is divided in Models, Adapters and the Main Log Class.

Models is mainly the Log Class, a DTO for all Logged Events and the Logtype enum, just a simple Enum to identitfy the type of a Log Event.

Adapters are just Adapter to other Logging Frameworks, LokiLogger provide only a simple ConsoleLogger for demo, which is used by default. To build your own LoggerAdapter Implement the ILogAdapter Interface.

The Loki Class provides the kernel Features like changing the Writer and or Log Events.

Features

Fast Logging. The Log Events are divided in:

  • Information ⇒ Nothing Special just an Information
  • Warning ⇒ Possible Issues
  • Critical ⇒ Failure in the System, expected Functionality cannot be provided
  • System Critical ⇒ System is unstable, Writers should send an Alert, when this Event happens

On every Log Event the Calling Class, Method and LineNumber is saved ⇒ it's quite easy to find the Error. (this is made without Reflection ⇒ it's quite fast)

Filter your Logs by LogLevel to different Loggers:

Loki.UpdateAdapter(new SerilogLoggerAdapter(),new List<LogLevel>(){LogLevel.Verbose,LogLevel.Information});

Now the Serilog Adapter will not get any Logs which are Verbose or Information Level.

Performance

Of course LokiLogger makes logging slower, but this impact is minimal (LokiLogger don't use Refelection as often mentioned)

Licence

This Libary is under MIT Lincense published.

https://www.nuget.org/packages/LokiLogger/

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 2.1

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LokiLogger:

Package Downloads
LokiHelper

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
3.0.9 706 12/11/2019
3.0.6 1,102 11/7/2019
3.0.5 2,144 9/4/2019
3.0.4 1,022 8/23/2019
3.0.3 843 8/23/2019
3.0.2 985 8/23/2019
3.0.1 674 7/31/2019
3.0.0 648 7/30/2019
2.2.5 923 7/29/2019
2.2.4.1 660 7/29/2019
2.2.4 682 7/29/2019
2.2.3 681 5/21/2019
2.2.2 654 5/12/2019
2.2.1 675 5/5/2019
2.2.0 664 5/5/2019
2.1.0 695 3/25/2019
2.0.2 655 3/21/2019
1.0.0 902 9/19/2018