Class LoggerExt

Namespace: ArmoniK.Api.Common.Utils
Assembly: ArmoniK.Api.Common.dll

Convenience methods for logging

[PublicAPI]
public static class LoggerExt

Inheritance

objectLoggerExt

Inherited Members

object.Equals(object), object.Equals(object, object), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object, object), object.ToString()

Methods

BeginNamedScope(ILogger, string, params (string, object)[])

Create a named logging scope that will start and end. It brings the given properties to every logs occurring in the scope

public static IDisposable BeginNamedScope(this ILogger logger, string name, params (string, object)[] properties)

Parameters

logger ILogger

Logger that will produce logs

name string

Name of the scope

properties (string, object)[]

Properties to put in the scope

Returns

IDisposable

object that can be dispose to terminate the scope

BeginPropertyScope(ILogger, params (string, object)[])

Create a logging scope that will start and end. It brings the given properties to every logs occurring in the scope

public static IDisposable BeginPropertyScope(this ILogger logger, params (string, object)[] properties)

Parameters

logger ILogger

Logger that will produce logs

properties (string, object)[]

Properties to put in the scope

Returns

IDisposable

object that can be dispose to terminate the scope

LogFunction(ILogger, string, LogLevel, string, string, int)

Logs the entering and leaving of a function represented by a scope

public static IDisposable LogFunction(this ILogger logger, string id = "", LogLevel level = LogLevel.Trace, string functionName = "", string classFilePath = "", int line = 0)

Parameters

logger ILogger

Logger that will produce logs

id string

Id of the under laying scope

level LogLevel

Level of logs produced

functionName string

Name of the function, found automatically with annotation

classFilePath string

Path to the filename containing the function, found automatically with annotation

line int

Line of the function, found automatically with annotation

Returns

IDisposable

object that can be dispose to terminate the scope