Table of Contents

Class LogExtensions

Namespace
Common.Log
Assembly
Lykke.Common.dll
[Obsolete("Use new extension methods defined in the MicrosoftLoggingBasedLogExtensions")]
public static class LogExtensions
Inheritance
LogExtensions
Inherited Members

Methods

CreateComponentScope(ILog, string)

Creates component scoped log

[Obsolete("Use new Lykke.Common.Log.ILogFactory")]
public static ILog CreateComponentScope(this ILog log, string component)

Parameters

log ILog

Log to wrap

component string

Component name for which scope will be created

Returns

ILog

Remarks

You can use it when you need to specify the same component for group of log writes. If you specify component in the particular log write, it will be concatenated with component

WriteError(ILog, string, object, Exception, DateTime?)

Writes error message

[Obsolete("Use overloads of the new extension methods: Error()")]
public static void WriteError(this ILog log, string process, object context, Exception exception = null, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
exception Exception
dateTime DateTime?

Remarks

Write a error when exception was thrown, but app can still run. If context is string, it will be passed as is, otherwise it will be converted to the Json

WriteFatalError(ILog, string, object, Exception, DateTime?)

Writes fatal error message

[Obsolete("Use overloads of the new extension methods: Critical()")]
public static void WriteFatalError(this ILog log, string process, object context, Exception exception = null, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
exception Exception
dateTime DateTime?

Remarks

Write a fatal error when exception was thrown and app can't still run anymore. If context is string, it will be passed as is, otherwise it will be converted to the Json

WriteInfo(ILog, string, object, string, DateTime?)

Writes info log message

[Obsolete("Use overloads of the new extension methods: Info()")]
public static void WriteInfo(this ILog log, string process, object context, string info, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
info string
dateTime DateTime?

Remarks

Write an info message about whatever you need to to simplify debugging and maintenance. If context is string, it will be passed as is, otherwise it will be converted to the Json

WriteMonitor(ILog, string, object, string, DateTime?)

Writes monitoring log message

[Obsolete]
public static void WriteMonitor(this ILog log, string process, object context, string info, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
info string
dateTime DateTime?

Remarks

Write a monitoring message about app lifecycle events or health events (start, stop, etc.). If context is string, it will be passed as is, otherwise it will be converted to the Json

WriteWarning(ILog, string, object, string, Exception, DateTime?)

Writes warning message with exception

[Obsolete("Use overloads of the new extension methods: Warning()")]
public static void WriteWarning(this ILog log, string process, object context, string info, Exception ex, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
info string
ex Exception
dateTime DateTime?

Remarks

Write a warning with exception when you catch an exception but it is not the error for you, and app can still run normally. If context is string, it will be passed as is, otherwise it will be converted to the Json

WriteWarning(ILog, string, object, string, DateTime?)

Writes warning message

[Obsolete("Use overloads of the new extension methods: Warning()")]
public static void WriteWarning(this ILog log, string process, object context, string info, DateTime? dateTime = null)

Parameters

log ILog
process string
context object
info string
dateTime DateTime?

Remarks

Write a warning when something went wrong without any exceptions, and app can still run normally. If context is string, it will be passed as is, otherwise it will be converted to the Json