jjm.one.Microsoft.Extensions.Logging.Helpers  2.0.0
A collection of helper functions for the Microsoft.Extensions.Logging logging tool.
jjm.one.Microsoft.Extensions.Logging.Helpers

A collection of helper functions for the Microsoft.Extensions.Logging logging tool.

Status

Build & Test Status (main) Build&Test
Nuget Package Version Nuget Version
SonarCloudQuality Gate Status Quality Gate Status

Table of contents

Nuget Package

You can get the latest version of this software as a nuget package form nuget.org

Installing the Nuget Package

Tool Command/Code
Package Manager PM> Install-Package jjm.one.Microsoft.Extensions.Logging.Helpers -Version X.Y.Z
.NET CLI > dotnet add package jjm.one.Microsoft.Extensions.Logging.Helpers --version X.Y.Z
PackageReference <PackageReference Include="jjm.one.Microsoft.Extensions.Logging.Helpers" Version="X.Y.Z" />
Package CLI > paket add jjm.one.Microsoft.Extensions.Logging.Helpers --version X.Y.Z
Script & Interactive > #r "nuget: jjm.one.Microsoft.Extensions.Logging.Helpers, X.Y.Z"
Cake as Addin #addin nuget:?package=jjm.one.Microsoft.Extensions.Logging.Helpers&version=X.Y.Z
Cake as Tool #tool nuget:?package=jjm.one.Microsoft.Extensions.Logging.Helpers&version=X.Y.Z

Usage

Use function logging

class MyClass {
// ...
void MyFancyFunction() {
// log the function call (minimal parameters)
logger.LogFctCall();
// log the function call (full parameters)
logger.LogFctCall(GetType(), MethodBase.GetCurrentMethod(), LogLevel.Debug);
try {
//...
}
catch (Exception exc) {
// Log the exception (minimal parameters)
logger.LogExcInFctCall(exc);
// Log the exception (full parameters)
logger.LogExcInFctCall(exc, GetType(), MethodBase.GetCurrentMethod(), "My custom exception message!", LogLevel.Error);
}
}
// ...
}

Output of function logging

Function called: MyClass -> MyFancyFunction
Exception thrown in: MyClass -> MyFancyFunction
My custom exception message!

Full Documentation

The full documentation for this package can be found here.

Repo

The associated repo for this package can be found here.