Example #1
0
        public void Trace(TraceLevel level, string message, [Nullable(2)] Exception ex)
        {
            if (level == TraceLevel.Off)
            {
                return;
            }
            TraceEventCache eventCache     = new TraceEventCache();
            TraceEventType  traceEventType = this.GetTraceEventType(level);

            foreach (object obj in System.Diagnostics.Trace.Listeners)
            {
                TraceListener traceListener = (TraceListener)obj;
                if (!traceListener.IsThreadSafe)
                {
                    TraceListener obj2 = traceListener;
                    lock (obj2)
                    {
                        traceListener.TraceEvent(eventCache, "Newtonsoft.Json", traceEventType, 0, message);
                        goto IL_7D;
                    }
                    goto IL_6E;
                }
                goto IL_6E;
IL_7D:
                if (System.Diagnostics.Trace.AutoFlush)
                {
                    traceListener.Flush();
                    continue;
                }
                continue;
IL_6E:
                traceListener.TraceEvent(eventCache, "Newtonsoft.Json", traceEventType, 0, message);
                goto IL_7D;
            }
        }
Example #2
0
        // Token: 0x06000D02 RID: 3330 RVA: 0x000477CC File Offset: 0x000459CC
        public void kmethod_2307(TraceLevel arg_0, string str_0, Exception arg_1)
        {
            if (arg_0 == TraceLevel.Off)
            {
                return;
            }
            TraceEventCache eventCache = new TraceEventCache();
            TraceEventType  eventType  = this.dmethod_2306(arg_0);

            foreach (object obj in Trace.Listeners)
            {
                TraceListener traceListener = (TraceListener)obj;
                if (!traceListener.IsThreadSafe)
                {
                    lock (traceListener)
                    {
                        traceListener.TraceEvent(eventCache, "Newtonsoft.Json", eventType, 0, str_0);
                        goto IL_7C;
                    }
                    goto IL_6D;
                }
                goto IL_6D;
IL_7C:
                if (Trace.AutoFlush)
                {
                    traceListener.Flush();
                    continue;
                }
                continue;
IL_6D:
                traceListener.TraceEvent(eventCache, "Newtonsoft.Json", eventType, 0, str_0);
                goto IL_7C;
            }
        }
        private void ExecuteSuccessQuery(TraceListener listener, string query, bool isFailure)
        {
            // Connection opened
            listener.TraceEvent(
                new TraceEventCache(),
                "mysql",
                TraceEventType.Information,
                1,
                "{0}: Connection Opened: connection string = '{1}'",
                1L,
                ConnStr,
                10);

            // Query opened
            listener.TraceEvent(
                new TraceEventCache(),
                "mysql",
                TraceEventType.Information,
                3,
                "{0}: Query Opened: {2}",
                1L,
                9,
                query);

            if (isFailure)
            {
                // Query error
                listener.TraceEvent(
                    new TraceEventCache(),
                    "mysql",
                    TraceEventType.Information,
                    13,
                    "{0}: Error encountered attempting to open result: Number={1}, Message={2}",
                    1L,
                    1064,
                    "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'selext 1/1' at line 1");
            }
            else
            {
                // Query closed
                listener.TraceEvent(
                    new TraceEventCache(),
                    "mysql",
                    TraceEventType.Information,
                    6,
                    "{0}: Query Closed",
                    1L);
            }
        }
Example #4
0
 private static void Trace(TraceListener tracer, TraceEventType eventType, string format, params object[] args)
 {
     if (tracer != null)
     {
         tracer.TraceEvent(null, "PostDeployment", eventType, (int)eventType, format, args);
     }
 }
Example #5
0
        private static bool DoTraceReplacement(string kind, Assembly report, string message)
        {
            string arg = string.Empty;

            try
            {
                arg = report.GetName().Name;
            }
            catch (MethodAccessException) { }

            TraceEventType type = (TraceEventType)Enum.Parse(typeof(TraceEventType), kind);

            lock (ListenersSyncRoot)
            {
                foreach (object obj in Listeners)
                {
                    TraceListener traceListener = (TraceListener)obj;
                    traceListener.TraceEvent(new TraceEventCache(), arg, type, 0, message);

                    if (AutoFlush)
                    {
                        traceListener.Flush();
                    }
                }
            }

            return(false);
        }
 public DebuggerTimer(DebuggerStatistics stats, string name)
 {
     stopwatch  = Stopwatch.StartNew();
     this.stats = stats;
     if (stats != null && traceListener != null)
     {
         traceId = Interlocked.Increment(ref traceSeq);
         traceListener.TraceEvent(null, stats.Name, TraceEventType.Start, traceId, name);
     }
 }
        public void Stop(bool success)
        {
            stopwatch.Stop();
            Success = success;

            if (stats == null)
            {
                return;
            }
            traceListener?.TraceEvent(null, stats.Name, TraceEventType.Stop, traceId, "Stop1");

            if (success)
            {
                stats.AddTime(stopwatch.Elapsed);
            }
            else
            {
                stats.IncrementFailureCount();
            }
        }
 public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
 => Lock(() => listener.TraceEvent(eventCache, source, eventType, id));