Ejemplo n.º 1
0
        /// <summary>
        /// Get the equivalent <see cref="EventLogEntryType"/> for a <see cref="Level"/> <paramref name="level"/>.
        /// </summary>
        /// <param name="level">the Level to convert to an EventLogEntryType.</param>
        /// <returns>The equivalent <see cref="EventLogEntryType"/> for a <see cref="Level"/> <paramref name="level"/>.</returns>
        /// <remarks>
        /// Because there are fewer applicable <see cref="EventLogEntryType"/>
        /// values to use in logging levels than there are in the
        /// <see cref="Level"/> this is a one way mapping. There is
        /// a loss of information during the conversion.
        /// </remarks>
        protected virtual EventLogEntryType GetEntryType(Level level)
        {
            // see if there is a specified lookup.
            Level2EventLogEntryType entryType = this.m_levelMapping.Lookup(level) as Level2EventLogEntryType;

            if (entryType != null)
            {
                return(entryType.EventLogEntryType);
            }

            // Use default behavior
            if (level >= Level.Error)
            {
                return(EventLogEntryType.Error);
            }
            else if (level == Level.Warn)
            {
                return(EventLogEntryType.Warning);
            }

            // Default setting
            return(EventLogEntryType.Information);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Add a mapping of level to <see cref="EventLogEntryType"/> - done by the config file
 /// </summary>
 /// <param name="mapping">The mapping to add</param>
 /// <remarks>
 /// <para>
 /// Add a <see cref="Level2EventLogEntryType"/> mapping to this appender.
 /// Each mapping defines the event log entry type for a level.
 /// </para>
 /// </remarks>
 public void AddMapping(Level2EventLogEntryType mapping)
 {
     m_levelMapping.Add(mapping);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Add a mapping of level to <see cref="EventLogEntryType"/> - done by the config file
 /// </summary>
 /// <param name="mapping">The mapping to add</param>
 /// <remarks>
 /// <para>
 /// Add a <see cref="Level2EventLogEntryType"/> mapping to this appender.
 /// Each mapping defines the event log entry type for a level.
 /// </para>
 /// </remarks>
 public void AddMapping(Level2EventLogEntryType mapping) {
   m_levelMapping.Add(mapping);
 }