Table of Contents

Class MicrosoftLoggingBasedLogExtensions

Namespace
Lykke.Common.Log
Assembly
Lykke.Common.dll

Extension methods for the Lykke logging system, based on Microsoft.Extensions.Logging

public static class MicrosoftLoggingBasedLogExtensions
Inheritance
MicrosoftLoggingBasedLogExtensions
Inherited Members

Methods

Critical(ILog, Exception, string, object, DateTime?, string, string, int)

Writes entry to the critical log.

Critical - logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention.

public static void Critical(this ILog log, Exception exception = null, string message = null, object context = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

exception Exception

Exception of the entry

message string

Message of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Critical(ILog, string, Exception, string, object, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Critical(ILog, string, Exception, string, object, DateTime?, string, int)

Writes entry to the critical log.

Critical - logs that describe an unrecoverable application or system crash, or a catastrophic failure that requires immediate attention.

public static void Critical(this ILog log, string process, Exception exception = null, string message = null, object context = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Critical(ILog, Exception, string, object, DateTime?, string, string, int) overload

exception Exception

Exception of the entry

message string

Message of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Debug(ILog, string, object, Exception, DateTime?, string, string, int)

Writes entry to the debug log.

Debug - logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value.

public static void Debug(this ILog log, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Debug(ILog, string, string, object, Exception, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Debug(ILog, string, string, object, Exception, DateTime?, string, int)

Writes entry to the debug log.

Debug - logs that are used for interactive investigation during development. These logs should primarily contain information useful for debugging and have no long-term value..

public static void Debug(this ILog log, string process, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Debug(ILog, string, object, Exception, DateTime?, string, string, int) overload

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Error(ILog, Exception, string, object, DateTime?, string, string, int)

Writes entry to the error log.

Error - logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.

public static void Error(this ILog log, Exception exception = null, string message = null, object context = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

exception Exception

Exception of the entry

message string

Message of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Error(ILog, string, Exception, string, object, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Error(ILog, string, Exception, string, object, DateTime?, string, int)

Writes entry to the error log.

Error - logs that highlight when the current flow of execution is stopped due to a failure. These should indicate a failure in the current activity, not an application-wide failure.

public static void Error(this ILog log, string process, Exception exception = null, string message = null, object context = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Error(ILog, Exception, string, object, DateTime?, string, string, int) overload

exception Exception

Exception of the entry

message string

Message of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Info(ILog, string, object, Exception, DateTime?, string, string, int)

Writes entry to the info log.

Info - logs that track the general flow of the application.These logs should have long-term value.

public static void Info(this ILog log, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Info(ILog, string, string, object, Exception, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Info(ILog, string, string, object, Exception, DateTime?, string, int)

Writes entry to the info log.

Info - logs that track the general flow of the application.These logs should have long-term value.

public static void Info(this ILog log, string process, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Info(ILog, string, object, Exception, DateTime?, string, string, int) overload

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Log(ILog, LogLevel, string, string, int, string, object, Exception, DateTime?)

public static void Log(this ILog log, LogLevel logLevel, string callerFilePath, string process, int callerLineNumber, string message, object context, Exception exception, DateTime? moment)

Parameters

log ILog

The log

logLevel LogLevel

Log severity level

callerFilePath string

Path of the source code file, where the entry was made. Use CallerFilePathAttribute in containing extension method, to pass actual file path.

process string

Name of the process where the entry was made. It could be method name or custom name. Use CallerMemberNameAttribute in containing extension method, to pass actual method name.

callerLineNumber int

Source code file line number, where the entry was made. Use CallerLineNumberAttribute in containing extension method, to pass actual value.

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

Trace(ILog, string, object, Exception, DateTime?, string, string, int)

Writes entry to the trace log.

Trace - logs that contain the most detailed messages. These messages may contain sensitive application data. These messages are disabled by default and should never be enabled in a production environment.

public static void Trace(this ILog log, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Trace(ILog, string, string, object, Exception, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Trace(ILog, string, string, object, Exception, DateTime?, string, int)

Writes entry to the trace log.

Trace - logs that contain the most detailed messages. These messages may contain sensitive application data. These messages are disabled by default and should never be enabled in a production environment.

public static void Trace(this ILog log, string process, string message, object context = null, Exception exception = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Trace(ILog, string, object, Exception, DateTime?, string, string, int) overload

message string

Message of the entry

context object

Context of the entry

exception Exception

Exception of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Warning(ILog, string, Exception, object, DateTime?, string, string, int)

Writes entry to the warning log.

Warning - logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.

public static void Warning(this ILog log, string message, Exception exception = null, object context = null, DateTime? moment = null, string callerFilePath = null, string process = null, int callerLineNumber = 0)

Parameters

log ILog

The log

message string

Message of the entry

exception Exception

Exception of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

process string

Name of the method where the entry was made. Do not pass argument to this parameter, it will be done by the compiler. If you want to specify custom process name, use Warning(ILog, string, string, Exception, object, DateTime?, string, int) overload

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

Warning(ILog, string, string, Exception, object, DateTime?, string, int)

Writes entry to the warning log.

Warning - logs that highlight an abnormal or unexpected event in the application flow, but do not otherwise cause the application execution to stop.

public static void Warning(this ILog log, string process, string message, Exception exception = null, object context = null, DateTime? moment = null, string callerFilePath = null, int callerLineNumber = 0)

Parameters

log ILog

The log

process string

Custom name of the process where the entry was made. If you want to use method name as the process name, use Warning(ILog, string, Exception, object, DateTime?, string, string, int) overload

message string

Message of the entry

exception Exception

Exception of the entry

context object

Context of the entry

moment DateTime?

Moment of the entry. Current momemnt will be used by default.

callerFilePath string

Path of the source code file, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler

callerLineNumber int

Source code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler