// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.ComponentModel; using System.Web.Http.Tracing; namespace System.Web.Http { /// /// This static class contains helper methods related to the registration /// of instances. /// [EditorBrowsable(EditorBrowsableState.Never)] public static class HttpConfigurationTracingExtensions { /// /// Creates and registers an implementation to use /// for this application. /// /// The for which /// to register the created trace writer. /// The returned SystemDiagnosticsTraceWriter may be further configured to change it's default settings. /// The which was created and registered. public static SystemDiagnosticsTraceWriter EnableSystemDiagnosticsTracing(this HttpConfiguration configuration) { if (configuration == null) { throw new ArgumentNullException("configuration"); } SystemDiagnosticsTraceWriter traceWriter = new SystemDiagnosticsTraceWriter() { MinimumLevel = TraceLevel.Info, IsVerbose = false }; configuration.Services.Replace(typeof(ITraceWriter), traceWriter); return traceWriter; } } }