Ejemplo n.º 1
0
        private void DoWriteLogs(int count)
        {
            //
            // Dequeue Events
            TracingEvent[] evts = new TracingEvent[count];

            lock (_queue) {
                for (int i = 0; i < count; i++)
                {
                    evts[i] = _queue.Dequeue();
                }
            }

            if (!_textAppender.Enabled)
            {
                return;
            }



            //
            // Writer Text Tracing
            if (_textAppender.Enabled || _textAppender.BackupForDbError)
            {
                try {
                    _textAppender.DoAppend(evts);
                } catch (Exception ex) {
                    SystemTrace.Error(EventID.SERVICE_ERROR, GetTracingSource(), TracingUtils.FormatException(ex));
                }
            }
        }
Ejemplo n.º 2
0
        private void WriteLog(TracingLevel level, string message)
        {
            TracingEvent logEvent = new TracingEvent();

            logEvent.Message    = message;
            logEvent.LoggerName = _loggerName;
            logEvent.Level      = level;

            DoAppend(logEvent);
        }
Ejemplo n.º 3
0
        public void Enqueue(TracingEvent evt)
        {
            if (_queue.Count > MaxQueueCapacity)
            {
                return;
            }

            lock (_queue) {
                _queue.Enqueue(evt);
            }
        }
Ejemplo n.º 4
0
        private void WriteLog(TracingLevel level, string message, string from, string to, string callId, string cseq)
        {
            TracingEvent logEvent = new TracingEvent();

            logEvent.Message    = message;
            logEvent.LoggerName = _loggerName;
            logEvent.Level      = level;
            logEvent.From       = from;
            logEvent.To         = to;
            logEvent.CallId     = callId;
            logEvent.Cseq       = cseq;

            DoAppend(logEvent);
        }
Ejemplo n.º 5
0
        internal static string GetLogString(TracingEvent logEvent)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("***\r\n-------------------------------------------------------------------------------\r\n");

            sb.AppendFormat("{0} [{1}] Tracing by <{2}> at \\\\{3} \r\n",
                            logEvent.TimeStamp.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                            logEvent.Level._levelName,
                            logEvent.LoggerName,
                            logEvent.WorkStation);

            sb.AppendFormat(
                "Process: <{0}> - \"{1}\" Thread: <{2}> - \"{3}\" \r\n",
                logEvent.ProcessId,
                logEvent.ProcessName,
                logEvent.ThreadId,
                logEvent.ThreadName
                );

            sb.AppendFormat("Message: {0}\r\n", logEvent.Message);

            if (logEvent.Error != null)
            {
                sb.Append(TracingUtils.FormatException(logEvent.Error));
            }

            if (logEvent.From != string.Empty)
            {
                sb.AppendFormat(
                    "[SIP INFO]: From: <{0}>\r\nTo: <{1}>\r\nCallId: <{2}>\r\nCSeq: <{3}>\r\n",
                    logEvent.From, logEvent.To, logEvent.CallId, logEvent.Cseq
                    );
            }

            sb.Append("-------------------------------------------------------------------------------\r\n");

            return(sb.ToString());
        }
Ejemplo n.º 6
0
 private void DoAppend(TracingEvent evt)
 {
     _thread.Enqueue(evt);
 }