예제 #1
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exit(TraceSource traceSource, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Verbose, 0, "Exiting " + msg);
            // Trace.CorrelationManager.StopLogicalOperation();
        }
예제 #2
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintInfo(TraceSource traceSource, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Information, 0, msg);
        }
예제 #3
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exit(TraceSource traceSource, string obj, string method, object retObject)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            string retValue = "";
            if (retObject != null)
            {
                retValue = GetObjectName(retObject) + "#" + Logging.HashString(retObject);
            }

            Exit(traceSource, obj, method, retValue);
        }
예제 #4
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exit(TraceSource traceSource, string obj, string method, string retValue)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            if (!string.IsNullOrEmpty(retValue))
            {
                retValue = "\t-> " + retValue;
            }

            Exit(traceSource, obj + "::" + method + "() " + retValue);
        }
예제 #5
0
 internal static void Exit(TraceSource traceSource, string msg)
 {
 }
예제 #6
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Enter(TraceSource traceSource, string obj, string method, string param)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            Enter(traceSource, obj + "::" + method + "(" + param + ")");
        }
예제 #7
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 private static bool GetUseProtocolTextSetting(TraceSource traceSource)
 {
     return(DefaultUseProtocolTextOnly);
 }
예제 #8
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Dump(TraceSource traceSource, object obj, string method, IntPtr bufferPtr, int length)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Verbose) || bufferPtr == IntPtr.Zero || length < 0)
            {
                return;
            }

            byte[] buffer = new byte[length];
            Marshal.Copy(bufferPtr, buffer, 0, length);
            Dump(traceSource, obj, method, buffer, 0, length);
        }
예제 #9
0
 internal static void PrintError(TraceSource traceSource, string msg)
 {
 }
예제 #10
0
 internal static void PrintLine(TraceSource traceSource, TraceEventType eventType, int id, string msg)
 {
     traceSource.TraceEvent(eventType, id, ("[" + GetThreadId().ToString("d4", CultureInfo.InvariantCulture) + "] ") + msg);
 }
예제 #11
0
 internal static void PrintWarning(TraceSource traceSource, string msg)
 {
 }
예제 #12
0
 internal static void PrintInfo(TraceSource traceSource, string msg)
 {
 }
예제 #13
0
 internal static void Exit(TraceSource traceSource, string msg, string parameters)
 {
 }
예제 #14
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintInfo(TraceSource traceSource, object obj, string method, string param)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Information, 0,
                                   GetObjectName(obj) + "#" + Logging.HashString(obj)
                                   + "::" + method + "(" + param + ")");
        }
예제 #15
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 private static int GetMaxDumpSizeSetting(TraceSource traceSource)
 {
     return(DefaultMaxDumpSize);
 }
예제 #16
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintError(TraceSource traceSource, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Error))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Error, 0, msg);
        }
예제 #17
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintLine(TraceSource traceSource, TraceEventType eventType, int id, string msg)
        {
            string logHeader = "[" + Environment.CurrentManagedThreadId.ToString("d4", CultureInfo.InvariantCulture) + "] ";

            traceSource.TraceEvent(eventType, id, logHeader + msg);
        }
예제 #18
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 internal static void PrintLine(TraceSource traceSource, TraceEventType eventType, int id, string msg)
 {
     string logHeader = "[" + Environment.CurrentManagedThreadId.ToString("d4", CultureInfo.InvariantCulture) + "] ";
     traceSource.TraceEvent(eventType, id, logHeader + msg);
 }
예제 #19
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 internal static bool IsVerbose(TraceSource traceSource)
 {
     return(ValidateSettings(traceSource, TraceEventType.Verbose));
 }
예제 #20
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            Enter(traceSource, GetObjectName(obj) + "#" + Logging.HashString(obj), method, paramObject);
        }
예제 #21
0
 internal static void Enter(TraceSource traceSource, object obj, string method, object paramObject)
 {
 }
예제 #22
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Enter(TraceSource traceSource, string obj, string method, object paramObject)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            string paramObjectValue = "";
            if (paramObject != null)
            {
                paramObjectValue = GetObjectName(paramObject) + "#" + Logging.HashString(paramObject);
            }

            Enter(traceSource, obj + "::" + method + "(" + paramObjectValue + ")");
        }
예제 #23
0
 internal static void Exit(TraceSource traceSource, object obj, string method, object retObject)
 {
 }
예제 #24
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exit(TraceSource traceSource, object obj, string method, string retValue)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            Exit(traceSource, GetObjectName(obj) + "#" + Logging.HashString(obj), method, retValue);
        }
예제 #25
0
 internal static void PrintWarning(TraceSource traceSource, object obj, string method, string msg)
 {
 }
예제 #26
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exit(TraceSource traceSource, string method, string parameters)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            Exit(traceSource, method + "() " + parameters);
        }
예제 #27
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 private static bool GetUseProtocolTextSetting(TraceSource traceSource)
 {
     return DefaultUseProtocolTextOnly;
 }
예제 #28
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Exception(TraceSource traceSource, object obj, string method, Exception e)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Error))
            {
                return;
            }

            string infoLine = SR.Format(SR.net_log_exception, GetObjectLogHash(obj), method, e.Message);
            if (!string.IsNullOrEmpty(e.StackTrace))
            {
                infoLine += Environment.NewLine + e.StackTrace;
            }

            PrintLine(traceSource, TraceEventType.Error, 0, infoLine);
        }
예제 #29
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 private static int GetMaxDumpSizeSetting(TraceSource traceSource)
 {
     return DefaultMaxDumpSize;
 }
예제 #30
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintInfo(TraceSource traceSource, object obj, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Information, 0,
                                   GetObjectName(obj) + "#" + Logging.HashString(obj)
                                   + " - " + msg);
        }
예제 #31
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        // Sets up internal config settings for logging.
        private static void InitializeLogging()
        {
            lock (InternalSyncObject)
            {
                if (!s_loggingInitialized)
                {
                    bool loggingEnabled = false;
                    s_webTraceSource = new NclTraceSource(TraceSourceWebName);
                    s_httpListenerTraceSource = new NclTraceSource(TraceSourceHttpListenerName);
                    s_socketsTraceSource = new NclTraceSource(TraceSourceSocketsName);
                    s_webSocketsTraceSource = new NclTraceSource(TraceSourceWebSocketsName);
                    s_cacheTraceSource = new NclTraceSource(TraceSourceCacheName);
                    s_traceSourceHttpName = new NclTraceSource(TraceSourceHttpName);

                    if (GlobalLog.IsEnabled)
                    {
                        GlobalLog.Print("Initalizating tracing");
                    }

                    try
                    {
                        loggingEnabled = (s_webTraceSource.Switch.ShouldTrace(TraceEventType.Critical) ||
                                          s_httpListenerTraceSource.Switch.ShouldTrace(TraceEventType.Critical) ||
                                          s_socketsTraceSource.Switch.ShouldTrace(TraceEventType.Critical) ||
                                          s_webSocketsTraceSource.Switch.ShouldTrace(TraceEventType.Critical) ||
                                          s_cacheTraceSource.Switch.ShouldTrace(TraceEventType.Critical) ||
                                          s_traceSourceHttpName.Switch.ShouldTrace(TraceEventType.Critical));
                    }
                    catch (SecurityException)
                    {
                        // These may throw if the caller does not have permission to hook up trace listeners.
                        // We treat this case as though logging were disabled.
                        Close();
                        loggingEnabled = false;
                    }

                    s_loggingEnabled = loggingEnabled;
                    s_loggingInitialized = true;
                }
            }
        }
예제 #32
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintWarning(TraceSource traceSource, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Warning))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Warning, 0, msg);
        }
예제 #33
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        // Confirms logging is enabled, given current logging settings
        private static bool ValidateSettings(TraceSource traceSource, TraceEventType traceLevel)
        {
            if (!s_loggingEnabled)
            {
                return false;
            }

            if (!s_loggingInitialized)
            {
                InitializeLogging();
            }

            if (traceSource == null || !traceSource.Switch.ShouldTrace(traceLevel))
            {
                return false;
            }

            return true;
        }
예제 #34
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void PrintError(TraceSource traceSource, object obj, string method, string msg)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Error))
            {
                return;
            }

            PrintLine(traceSource, TraceEventType.Error, 0,
                                   GetObjectName(obj) + "#" + Logging.HashString(obj)
                                   + "::" + method + "() - " + msg);
        }
예제 #35
0
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Associate(TraceSource traceSource, object objA, object objB)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Information))
            {
                return;
            }

            string lineA = GetObjectName(objA) + "#" + Logging.HashString(objA);
            string lineB = GetObjectName(objB) + "#" + Logging.HashString(objB);

            PrintLine(traceSource, TraceEventType.Information, 0, "Associating " + lineA + " with " + lineB);
        }
예제 #36
0
파일: Logging.cs 프로젝트: jemmy655/corefx
 internal static bool IsVerbose(TraceSource traceSource)
 {
     return ValidateSettings(traceSource, TraceEventType.Verbose);
 }
예제 #37
0
 internal static void Exception(TraceSource traceSource, object obj, string method, Exception e)
 {
 }
예제 #38
-7
파일: Logging.cs 프로젝트: jemmy655/corefx
        internal static void Dump(TraceSource traceSource, object obj, string method, byte[] buffer, int offset, int length)
        {
            if (!ValidateSettings(traceSource, TraceEventType.Verbose))
            {
                return;
            }

            if (buffer == null)
            {
                PrintLine(traceSource, TraceEventType.Verbose, 0, "(null)");
                return;
            }

            if (offset > buffer.Length)
            {
                PrintLine(traceSource, TraceEventType.Verbose, 0, "(offset out of range)");
                return;
            }

            PrintLine(traceSource, TraceEventType.Verbose, 0, "Data from " + GetObjectName(obj) + "#" + Logging.HashString(obj) + "::" + method);
            int maxDumpSize = GetMaxDumpSizeSetting(traceSource);
            if (length > maxDumpSize)
            {
                PrintLine(traceSource, TraceEventType.Verbose, 0, "(printing " + maxDumpSize.ToString(NumberFormatInfo.InvariantInfo) + " out of " + length.ToString(NumberFormatInfo.InvariantInfo) + ")");
                length = maxDumpSize;
            }

            if ((length < 0) || (length > buffer.Length - offset))
            {
                length = buffer.Length - offset;
            }

            do
            {
                int n = Math.Min(length, 16);
                string disp = string.Format(CultureInfo.CurrentCulture, "{0:X8} : ", offset);
                for (int i = 0; i < n; ++i)
                {
                    disp += string.Format(CultureInfo.CurrentCulture, "{0:X2}", buffer[offset + i]) + ((i == 7) ? '-' : ' ');
                }

                for (int i = n; i < 16; ++i)
                {
                    disp += "   ";
                }

                disp += ": ";
                for (int i = 0; i < n; ++i)
                {
                    disp += ((buffer[offset + i] < 0x20) || (buffer[offset + i] > 0x7e))
                                ? '.'
                                : (char)(buffer[offset + i]);
                }

                PrintLine(traceSource, TraceEventType.Verbose, 0, disp);
                offset += n;
                length -= n;
            } while (length > 0);
        }