Class ILoggerObjectExtensions
ILoggerObject extension methods for common scenarios.
Inheritance
Namespace: SigStat.Common
Assembly: SigStat.Common.dll
Syntax
public static class ILoggerObjectExtensions : object
Remarks
Note to framework developers: you may extend this class with additional overloads if they are required
Methods
| Improve this Doc View SourceLogCritical(ILoggerObject, String, Object[])
Formats and writes an critical error log message.
Declaration
public static void LogCritical(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogDebug(ILoggerObject, String, Object[])
Formats and writes an debug log message.
Declaration
public static void LogDebug(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogError(ILoggerObject, Exception, String, Object[])
Formats and writes an error log message.
Declaration
public static void LogError(this ILoggerObject obj, Exception exception, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
Exception | exception | The exception to log. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogError(ILoggerObject, String, Object[])
Formats and writes an error log message.
Declaration
public static void LogError(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogInformation(ILoggerObject, String, Object[])
Formats and writes an informational log message.
Declaration
public static void LogInformation(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogTrace(ILoggerObject, String, Object[])
Formats and writes a trace log message.
Declaration
public static void LogTrace(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogTrace<TState>(ILoggerObject, TState, EventId, Exception, Func<TState, Exception, String>)
Formats and writes a trace log message with state.
Declaration
public static void LogTrace<TState>(this ILoggerObject obj, TState state, EventId eventId = null, Exception exception = null, Func<TState, Exception, string> formatter = null)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
TState | state | The entry to be written. |
EventId | eventId | Id of the event. |
Exception | exception | The exception related to this entry. |
Func<TState, Exception, System.String> | formatter | Function to create a String message of the state and exception. |
Type Parameters
Name | Description |
---|---|
TState | The type of the object to be written (preferably a descendant of SigstatLogState). |
LogWarning(ILoggerObject, Exception, String, Object[])
Formats and writes an warning log message.
Declaration
public static void LogWarning(this ILoggerObject obj, Exception exception, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
Exception | exception | The exception to log. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |
LogWarning(ILoggerObject, String, Object[])
Formats and writes an warning log message.
Declaration
public static void LogWarning(this ILoggerObject obj, string message, params object[] args)
Parameters
Type | Name | Description |
---|---|---|
ILoggerObject | obj | The SigStat.Common.ILoggerObject containing the Logger to write to. |
System.String | message | Format string of the log message in message template format. Example: "User {User} logged in from {Address}" |
System.Object[] | args | An object array that contains zero or more objects to format. |