﻿// Decompiled with JetBrains decompiler
// Type: System.Web.Management.TraceWebEventProvider
// Assembly: System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
// MVID: 7E68A73E-4066-4F24-AB0A-F147209F50EC
// Assembly location: C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Web.dll

using System.Collections.Specialized;
using System.Diagnostics;
using System.Runtime;
using System.Web.Util;

namespace System.Web.Management
{
  /// <summary>
  /// Implements an event provider that sends ASP.NET health-monitoring events as trace messages.
  /// </summary>
  public sealed class TraceWebEventProvider : WebEventProvider, IInternalWebEventProvider
  {
    [TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
    internal TraceWebEventProvider()
    {
    }

    /// <summary>
    /// Sets the initial values for this object.
    /// </summary>
    /// <param name="name">The name used in the configuration file to identify this provider.</param><param name="config">A <see cref="T:System.Collections.Specialized.NameValueCollection"/> that specifies the attributes assigned for this provider in the configuration file.</param>
    public override void Initialize(string name, NameValueCollection config)
    {
      base.Initialize(name, config);
      ProviderUtil.CheckUnrecognizedAttributes(config, name);
    }

    /// <summary>
    /// Processes the event passed to the provider.
    /// </summary>
    /// <param name="eventRaised">The <see cref="T:System.Web.Management.WebBaseEvent"/> object to process.</param>
    public override void ProcessEvent(WebBaseEvent eventRaised)
    {
      if (eventRaised is WebBaseErrorEvent)
        Trace.TraceError(eventRaised.ToString());
      else
        Trace.TraceInformation(eventRaised.ToString());
    }

    /// <summary>
    /// Removes all events from the provider's buffer.
    /// </summary>
    public override void Flush()
    {
    }

    /// <summary>
    /// Performs tasks associated with shutting down the provider.
    /// </summary>
    public override void Shutdown()
    {
    }
  }
}
