Ejemplo n.º 1
0
        public void AddLogItem(int RoundTrip)
        {
            TraceLogItem tli = new TraceLogItem();

            tli.RoundTrip = RoundTrip;
            TraceLog.Add(tli);
            while (TraceLog.Count > pingMemory)
            {
                TraceLog.Remove(TraceLog.OrderBy(i => i.TimeStamp).First());
            }
        }
Ejemplo n.º 2
0
 internal void AddTraceLogItem(DateTime dt, byte[] data, bool isOutcome)
 {
     if (data != null && data.Length > 0)
     {
         if (TraceLog.Count < 10)
         {
             mTraceLogString = null;
             TraceLog.Add(new TraceLogItem(dt, data, isOutcome));
         }
         else if (!mIsLogSealed)
         {
             mTraceLogString += "too many log items" + Environment.NewLine;
             mIsLogSealed     = true;
         }
     }
 }
            public void TraceData(TraceEventType eventType, int id, object data)
            {
                string _message = $"{eventType} at {id}: {data}";

                switch (eventType)
                {
                case TraceEventType.Critical:
                case TraceEventType.Error:
                case TraceEventType.Warning:
                    ErrorTraceLog.Add(_message);
                    break;

                case TraceEventType.Information:
                case TraceEventType.Verbose:
                case TraceEventType.Start:
                case TraceEventType.Stop:
                case TraceEventType.Suspend:
                case TraceEventType.Resume:
                case TraceEventType.Transfer:
                    TraceLog.Add(_message);
                    break;
                }
                Debug.WriteLine(_message);
            }