-
Notifications
You must be signed in to change notification settings - Fork 0
net90_EventLogHelper.Interfaces_IEventLogWriter
dparvin edited this page Sep 10, 2025
·
1 revision
Defines the contract for writing to and managing Windows Event Logs.
public interface IEventLogWriter| name | description |
|---|---|
| CreateEventSource(…) | Creates a new event source for the specified log on the given machine, if it does not already exist. |
| Exists(…) | Determines whether the specified event log exists on the given machine. |
| GetLog(…) | Retrieves or initializes an EventLog instance with the specified configuration. |
| GetLogForSource(…) | Retrieves the name of the event log that a given source is registered under on the specified machine. |
| SourceExists(…) | Determines whether the specified event source is registered on the given machine. |
| WriteEntry(…) | Writes an entry to the specified event log using explicit log and source details. (2 methods) |
The IEventLogWriter interface abstracts all direct interactions with EventLog. This allows event log operations (such as creating sources, checking for existence, and writing entries) to be performed in a testable and mockable way.
The default implementation wraps the .NET Framework EventLog API, but custom implementations can be supplied for unit testing, redirection (e.g., writing to a file), or specialized logging behavior.
- namespace EventLogHelper.Interfaces
- assembly EventLogHelper
- IEventLogWriter.cs