示例#1
0
        internal static void TraceOut(TraceLevel level, string text, string category, int indent)
        {
            if (
                level.Equals(TraceLevel.Error) && TcPluginTraceSwitch.TraceError ||
                level.Equals(TraceLevel.Warning) && TcPluginTraceSwitch.TraceWarning ||
                level.Equals(TraceLevel.Info) && TcPluginTraceSwitch.TraceInfo ||
                level.Equals(TraceLevel.Verbose) && TcPluginTraceSwitch.TraceVerbose
                )
            {
                var timeStr = GetTraceTimeString();
                if (indent < 0 && Trace.IndentLevel > 0)
                {
                    Trace.IndentLevel--;
                }

                var levelStr = level.ToString()
                               .Replace("Verbose", "Debug")
                               .Replace("Warning", "Warn ")
                               .Replace("Info", "Info ");

                Trace.WriteLine($"[A{AppDomain.CurrentDomain.Id}|T{Thread.CurrentThread.ManagedThreadId}] {text}", timeStr + " - " + levelStr + " - " + category);

                if (indent > 0)
                {
                    Trace.IndentLevel++;
                }
            }
        }
示例#2
0
 public static void TraceOut(TraceLevel level, string text, string category, int indent)
 {
     if (level.Equals(TraceLevel.Error) && TcPluginTraceSwitch.TraceError ||
         level.Equals(TraceLevel.Warning) && TcPluginTraceSwitch.TraceWarning ||
         level.Equals(TraceLevel.Info) && TcPluginTraceSwitch.TraceInfo ||
         level.Equals(TraceLevel.Verbose) && TcPluginTraceSwitch.TraceVerbose)
     {
         string timeStr = GetTraceTimeString();
         if (indent < 0 && Trace.IndentLevel > 0)
         {
             Trace.IndentLevel--;
         }
         Trace.WriteLine(text, timeStr + " - " + category);
         if (indent > 0)
         {
             Trace.IndentLevel++;
         }
     }
 }