A collection of helper functions for the Serilog.Extensions.Logging logging tool.
Build & Test Status (main) | |
Nuget Package Version | |
SonarCloudQuality Gate Status |
You can get the latest version of this software as a nuget package form nuget.org
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 |
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);
}
}
// ...
}
Function called: MyClass -> MyFancyFunction
Exception thrown in: MyClass -> MyFancyFunction
My custom exception message!
The full documentation for this package can be found here.
The associated repo for this package can be found here.