Skip to content

jjm-one/jjm.one.Serilog.Extensions.Logging.Helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jjm.one.Serilog.Extensions.Logging.Helpers

A collection of helper functions for the Serilog.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.Serilog.Extensions.Logging.Helper -Version X.Y.Z
.NET CLI > dotnet add package jjm.one.Serilog.Extensions.Logging.Helper --version X.Y.Z
PackageReference <PackageReference Include="jjm.one.Serilog.Extensions.Logging.Helper" Version="X.Y.Z" />
Package CLI > paket add jjm.one.Serilog.Extensions.Logging.Helper --version X.Y.Z
Script & Interactive > #r "nuget: jjm.one.Serilog.Extensions.Logging.Helper, X.Y.Z"
Cake as Addin #addin nuget:?package=jjm.one.Serilog.Extensions.Logging.Helper&version=X.Y.Z
Cake as Tool #tool nuget:?package=jjm.one.Serilog.Extensions.Logging.Helper&version=X.Y.Z

Usage

Use function logging

class MyClass {

    // ...

    void MyFancyFunction() {

        // log the function call (minimal parameters)
        Log.Logger.LogFctCall();

        // log the function call (full parameters)
        Log.Logger.LogFctCall(GetType(), MethodBase.GetCurrentMethod(), LogEventLevel.Debug);

        try {
            
            //...
        }
        catch (Exception exc) {

            // Log the exception (minimal parameters)      
            Log.Logger.LogExcInFctCall(exc);      

            // Log the exception (full parameters)
            Log.Logger.LogExcInFctCall(exc, GetType(), MethodBase.GetCurrentMethod(), "My custom exception message!", LogEventLevel.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.