src/NLog/Targets/EventLogTarget.cs
/// <summary>
/// Get the entry type for logging the message.
/// </summary>
/// <param name="logEvent">The logging event - for rendering the <see cref="EntryType"/></param>
Get the entry type for logging the message.
Get the entry type for logging the message .
private EventLogEntryType GetEntryType(LogEventInfo logEvent)
        {
            string renderEntryType = RenderLogEvent(EntryType, logEvent);
            if (!string.IsNullOrEmpty(renderEntryType))
            {
                if (ConversionHelpers.TryParseEnum(renderEntryType, out EventLogEntryType eventLogEntryType))
                {
                    return eventLogEntryType;
                }
                InternalLogger.Warn("EventLogTarget(Name={0}): WriteEntry failed to parse EntryType={1}", Name, renderEntryType);
            }
            if (logEvent.Level >= LogLevel.Error)
            {
                return EventLogEntryType.Error;
            }
            if (logEvent.Level >= LogLevel.Warn)
            {
                return EventLogEntryType.Warning;
            }
            return EventLogEntryType.Information;
        }
private EventLogEntryType GetEntryType ( LogEventInfo logEvent ) { string renderEntryType = RenderLogEvent ( EntryType , logEvent ) ; if ( ! string . IsNullOrEmpty ( renderEntryType ) ) { if ( ConversionHelpers . TryParseEnum ( renderEntryType , out EventLogEntryType eventLogEntryType ) ) { return eventLogEntryType ; } InternalLogger . Warn ( " " , Name , renderEntryType ) ; } if ( logEvent . Level >= LogLevel . Error ) { return EventLogEntryType . Error ; } if ( logEvent . Level >= LogLevel . Warn ) { return EventLogEntryType . Warning ; } return EventLogEntryType . Information ; }
Get the entry type for logging the message.
Get the entry type for logging the message .
// try parse, if fail, determine auto // determine auto
logEvent
LogEventInfo
The logging event - for rendering the
The logging event - for rendering the