Пример #1
0
        public override void Write(string message)
        {
            var te = new TraceEvent
            {
                Cache  = new TraceEventCache(),
                Format = message,
                Type   = TraceEventType.Information
            };

            lock (this)
            {
                events.Add(te);
                try
                {
                    if (events.Count > 1000)
                    {
                        events.RemoveAt(0);
                    }
                }
                catch (Exception)
                {
                }
            }
            if (OnEventAdd != null)
            {
                OnEventAdd.Invoke(te);
            }
        }
Пример #2
0
        public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format, params object[] args)
        {
            var te = new TraceEvent
            {
                Cache  = eventCache,
                Source = source,
                Type   = eventType,
                Id     = id,
                Format = format,
                Args   = args
            };

            lock (this)
            {
                events.Add(te);
                try
                {
                    if (events.Count > 1000)
                    {
                        events.RemoveAt(0);
                    }
                }
                catch (Exception)
                {
                }
            }
            if (OnEventAdd != null)
            {
                OnEventAdd.Invoke(te);
            }
        }
Пример #3
0
        public override void TraceEvent(TraceEventCache eventCache, string source, TraceEventType eventType, int id)
        {
            var te = new TraceEvent {
                Cache = eventCache, Source = source, Type = eventType, Id = id
            };

            Events.Add(te);
            try
            {
                if (Events.Count > 1000)
                {
                    Events.RemoveAt(0);
                }
            }
            catch (Exception) { }
            if (OnEventAdd != null)
            {
                OnEventAdd.Invoke(te);
            }
        }
Пример #4
0
        public override void WriteLine(string message)
        {
            var te = new TraceEvent
            {
                Cache   = new TraceEventCache(),
                Message = message + Environment.NewLine,
                Type    = TraceEventType.Information
            };

            Events.Add(te);
            try
            {
                if (Events.Count > 1000)
                {
                    Events.RemoveAt(0);
                }
            }
            catch (Exception) { }
            if (OnEventAdd != null)
            {
                OnEventAdd.Invoke(te);
            }
        }