Class MicrosoftLoggingBasedLogExtensions
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
ILogThe log
exception
ExceptionException of the entry
message
stringMessage of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
ExceptionException of the entry
message
stringMessage of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource 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
ILogThe log
message
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource 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
ILogThe log
exception
ExceptionException of the entry
message
stringMessage of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
ExceptionException of the entry
message
stringMessage of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource 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
ILogThe log
message
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource 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?)
This is low level method and usually should not be used directly in the app. It's inteded to be used only by the extension methods. App developer usually should use one of: Trace(ILog, string, object, Exception, DateTime?, string, string, int), Debug(ILog, string, object, Exception, DateTime?, string, string, int), Info(ILog, string, object, Exception, DateTime?, string, string, int), Warning(ILog, string, Exception, object, DateTime?, string, string, int), Error(ILog, Exception, string, object, DateTime?, string, string, int), Critical(ILog, Exception, string, object, DateTime?, string, string, int) extension methods or they overloads
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
ILogThe log
logLevel
LogLevelLog severity level
callerFilePath
stringPath of the source code file, where the entry was made. Use CallerFilePathAttribute in containing extension method, to pass actual file path.
process
stringName 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
intSource code file line number, where the entry was made. Use CallerLineNumberAttribute in containing extension method, to pass actual value.
message
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException 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
ILogThe log
message
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
stringMessage of the entry
context
objectContext of the entry
exception
ExceptionException of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource 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
ILogThe log
message
stringMessage of the entry
exception
ExceptionException of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
stringName 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
intSource 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
ILogThe log
process
stringCustom 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
stringMessage of the entry
exception
ExceptionException of the entry
context
objectContext of the entry
moment
DateTime?Moment of the entry. Current momemnt will be used by default.
callerFilePath
stringPath 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
intSource code file line number, where the entry was made. Do not pass argument to this parameter, it will be done by the compiler