src/Serilog.Sinks.EventLog/LoggerConfigurationEventLogExtensions.cs
/// <summary>
/// Adds a sink that writes log events to the Windows event log.
/// </summary>
/// <param name="loggerConfiguration">The logger configuration.</param>
/// <param name="source">The source name by which the application is registered on the local computer.</param>
/// <param name="logName">The name of the log the source's entries are written to. Possible values include Application, System, or a custom event log.</param>
/// <param name="machineName">The name of the machine hosting the event log written to.  The local machine by default.</param>
/// <param name="manageEventSource">If false does not check/create event source.  Defaults to true i.e. allow sink to manage event source creation</param>
/// <param name="restrictedToMinimumLevel">The minimum log event level required in order to write an event to the sink.</param>
/// <param name="formatter">Formatter to control how events are rendered into the file. To control
/// plain text formatting, use the overload that accepts an output template instead.</param>
/// <param name="eventIdProvider">Supplies event ids for emitted log events.</param>
/// <returns>
/// Logger configuration, allowing configuration to continue.
/// </returns>
/// <exception cref="System.ArgumentNullException">loggerConfiguration</exception>
/// <exception cref="ArgumentNullException">A required parameter is null.</exception>
Adds a sink that writes log events to the Windows event log.
Adds a sink that writes log events to the Windows event log .
public static LoggerConfiguration EventLog(
            this LoggerSinkConfiguration loggerConfiguration,
            ITextFormatter formatter,
            string source,
            string logName = null,
            string machineName = ".",
            bool manageEventSource = false,
            LogEventLevel restrictedToMinimumLevel = LevelAlias.Minimum,
            IEventIdProvider eventIdProvider = null)
        {
            if (loggerConfiguration == null) throw new ArgumentNullException(nameof(loggerConfiguration));
            if (formatter == null) throw new ArgumentNullException(nameof(formatter));
            if (eventIdProvider == null)
            {
                return loggerConfiguration.Sink(new EventLogSink(source, logName, formatter, machineName, manageEventSource), restrictedToMinimumLevel);
            }
            return loggerConfiguration.Sink(new EventLogSink(source, logName, formatter, machineName, manageEventSource, eventIdProvider), restrictedToMinimumLevel);
        }
public static LoggerConfiguration EventLog ( this LoggerSinkConfiguration loggerConfiguration , ITextFormatter formatter , string source , string logName = null , string machineName = " " , bool manageEventSource = false , LogEventLevel restrictedToMinimumLevel = LevelAlias . Minimum , IEventIdProvider eventIdProvider = null ) { if ( loggerConfiguration == null ) throw new ArgumentNullException ( nameof ( loggerConfiguration ) ) ; if ( formatter == null ) throw new ArgumentNullException ( nameof ( formatter ) ) ; if ( eventIdProvider == null ) { return loggerConfiguration . Sink ( new EventLogSink ( source , logName , formatter , machineName , manageEventSource ) , restrictedToMinimumLevel ) ; } return loggerConfiguration . Sink ( new EventLogSink ( source , logName , formatter , machineName , manageEventSource , eventIdProvider ) , restrictedToMinimumLevel ) ; }
Adds a sink that writes log events to the Windows event log.
Adds a sink that writes log events to the Windows event log .
Logger configuration, allowing configuration to continue.
Logger configuration allowing configuration to continue .
None
A required parameter is null.
A required parameter is null .
LoggerSinkConfiguration
this
formatter
ITextFormatter
Formatter to control how events are rendered into the file. To control
plain text formatting, use the overload that accepts an output template instead.
Formatter to control how events are rendered into the file . To control plain text formatting use the overload that accepts an output template instead .
source
string
The source name by which the application is registered on the local computer.
The source name by which the application is registered on the local computer .
logName
string
The name of the log the source's entries are written to. Possible values include Application, System, or a custom event log.
The name of the log the source ' s entries are written to . Possible values include Application System or a custom event log .
machineName
string
The name of the machine hosting the event log written to.  The local machine by default.
The name of the machine hosting the event log written to . The local machine by default .
manageEventSource
bool
If false does not check/create event source.  Defaults to true i.e. allow sink to manage event source creation
If false does not check / create event source . Defaults to true i . e . allow sink to manage event source creation
restrictedToMinimumLevel
LogEventLevel
The minimum log event level required in order to write an event to the sink.
The minimum log event level required in order to write an event to the sink .
eventIdProvider
IEventIdProvider
Supplies event ids for emitted log events.
Supplies event ids for emitted log events .
loggerConfiguration
The logger configuration.
The logger configuration .