EventLogLogger Class¶
A logger that writes messages to Windows Event Log.
- Namespace
Microsoft.Extensions.Logging.EventLog
- Assemblies
- Microsoft.Extensions.Logging.EventLog
Syntax¶
public class EventLogLogger : ILogger
-
class
Microsoft.Extensions.Logging.EventLog.
EventLogLogger
Constructors¶
-
EventLogLogger
(System.String)¶ Initializes a new instance of the
Microsoft.Extensions.Logging.EventLog.EventLogLogger
class.Arguments: name (System.String) – The name of the logger. public EventLogLogger(string name)
-
EventLogLogger
(System.String, Microsoft.Extensions.Logging.EventLog.EventLogSettings) Initializes a new instance of the
Microsoft.Extensions.Logging.EventLog.EventLogLogger
class.Arguments: - name (System.String) – The name of the logger.
- settings (Microsoft.Extensions.Logging.EventLog.EventLogSettings) – The
Microsoft.Extensions.Logging.EventLog.EventLogSettings
.
public EventLogLogger(string name, EventLogSettings settings)
-
Methods¶
-
BeginScope<TState>
(TState)¶ Return type: System.IDisposable public IDisposable BeginScope<TState>(TState state)
-
IsEnabled
(Microsoft.Extensions.Logging.LogLevel)¶ Return type: System.Boolean public bool IsEnabled(LogLevel logLevel)
-
Log<TState>
(Microsoft.Extensions.Logging.LogLevel, Microsoft.Extensions.Logging.EventId, TState, System.Exception, System.Func<TState, System.Exception, System.String>)¶ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
-
Properties¶
-
Microsoft.Extensions.Logging.EventLog.EventLogLogger.
EventLog
¶ Return type: Microsoft.Extensions.Logging.EventLog.Internal.IEventLog public IEventLog EventLog { get; }
-