TraceUtility.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / System.ServiceModel.Activation / System / ServiceModel / Activation / Diagnostics / TraceUtility.cs / 1305376 / TraceUtility.cs

                            //---------------------------------------------------------------------------- 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//---------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Diagnostics
{ 
    using System;
    using System.Diagnostics; 
    using System.Runtime.Diagnostics; 
    using System.Collections.Generic;
    using System.Globalization; 

    static class TraceUtility
    {
        static Dictionary traceCodes = new Dictionary(7) 
        {
            { TraceCode.WebHostFailedToCompile, "WebHostFailedToCompile" }, 
            { TraceCode.WebHostServiceActivated, "WebHostServiceActivated" }, 
            { TraceCode.WebHostFailedToActivateService, "WebHostFailedToActivateService" },
            { TraceCode.WebHostCompilation, "WebHostCompilation" }, 
            { TraceCode.WebHostDebugRequest, "WebHostDebugRequest" },
            { TraceCode.WebHostProtocolMisconfigured, "WebHostProtocolMisconfigured" },
            { TraceCode.WebHostServiceCloseFailed, "WebHostServiceCloseFailed" },
            { TraceCode.WebHostNoCBTSupport, "WebHostNoCBTSupport" }, 
        };
 
        internal static void TraceEvent(TraceEventType severity, int traceCode, string traceDescription, object source) 
        {
            TraceEvent(severity, traceCode, traceDescription, null, source, null); 
        }

        internal static void TraceEvent(TraceEventType severity, int traceCode, string traceDescription, object source, Exception exception)
        { 
            TraceEvent(severity, traceCode, traceDescription, null, source, exception);
        } 
 
        internal static void TraceEvent(TraceEventType severity, int traceCode, string traceDescription, TraceRecord record, object source, Exception exception)
        { 
            string msdnTraceCode = System.ServiceModel.Diagnostics.DiagnosticTrace.GenerateMsdnTraceCode("System.ServiceModel.Activation", traceCodes[traceCode]);
            DiagnosticUtility.DiagnosticTrace.TraceEvent(severity, traceCode, msdnTraceCode, traceDescription, record, exception, source);
        }
 
        internal static string CreateSourceString(object source)
        { 
            return source.GetType().ToString() + "/" + source.GetHashCode().ToString(CultureInfo.CurrentCulture); 
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK