Class EventLogServiceExtensions
Extension methods for the IEventLogService
public static class EventLogServiceExtensions
- Inheritance
-
objectEventLogServiceExtensions
Remarks
These extension methods are maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
Methods
LogError(IEventLogService, string, string, string, LoggingPolicy)
Writes a new error to the event log.
public static void LogError(this IEventLogService eventLogService, string source, string eventCode, string eventDescription = null, LoggingPolicy loggingPolicy = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (Security, Update, Delete, etc.)
eventDescriptionstringAdditional event information
loggingPolicyLoggingPolicyLogging policy
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the eventDescription parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
LogEvent(IEventLogService, EventTypeEnum, string, string, string)
Writes a new record to the event log.
public static void LogEvent(this IEventLogService eventLogService, EventTypeEnum eventType, string source, string eventCode, string eventDescription = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
eventTypeEventTypeEnumType of the event EventTypeEnum
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (UPDATEDOC, SENDEMAIL, DELETE, etc.)
eventDescriptionstringDetailed description of the event
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the eventDescription parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
LogException(IEventLogService, string, string, Exception, string, LoggingPolicy)
Writes a new error to the event log.
public static void LogException(this IEventLogService eventLogService, string source, string eventCode, Exception ex, string additionalMessage = null, LoggingPolicy loggingPolicy = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (UPDATEDOC, SENDEMAIL, DELETE, etc.)
exExceptionException to be logged
additionalMessagestringAdditional information to the exception message
loggingPolicyLoggingPolicyLogging policy.
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the additionalMessage parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
LogInformation(IEventLogService, string, string, string, LoggingPolicy)
Writes a new information to the event log.
public static void LogInformation(this IEventLogService eventLogService, string source, string eventCode, string eventDescription = null, LoggingPolicy loggingPolicy = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (Security, Update, Delete, etc.)
eventDescriptionstringAdditional event information
loggingPolicyLoggingPolicyLogging policy
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the eventDescription parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
LogWarning(IEventLogService, string, string, Exception, string, LoggingPolicy)
Writes a new warning to the event log.
public static void LogWarning(this IEventLogService eventLogService, string source, string eventCode, Exception ex, string additionalMessage = null, LoggingPolicy loggingPolicy = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (UPDATEDOC, SENDEMAIL, DELETE, etc.)
exExceptionException to be logged
additionalMessagestringAdditional information to the exception message
loggingPolicyLoggingPolicyLogging policy
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the additionalMessage parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.
LogWarning(IEventLogService, string, string, string, LoggingPolicy)
Writes a new warning to the event log.
public static void LogWarning(this IEventLogService eventLogService, string source, string eventCode, string eventDescription = null, LoggingPolicy loggingPolicy = null)
Parameters
eventLogServiceIEventLogServiceEvent log service that logs the arguments
sourcestringSource of the event (Content, Administration, etc.)
eventCodestringEvent code (Security, Update, Delete, etc.)
eventDescriptionstringAdditional event information
loggingPolicyLoggingPolicyLogging policy
Remarks
Parameters source and eventCode are limited to 100 characters.
If a longer value needs to be logged, use the eventDescription parameter.
This method is maintained for backward compatibility. For new development, use Microsoft.Extensions.Logging.ILogger instead.