Ejemplo n.º 1
0
        /// <inheritdoc />
        protected override void OnError(EventWrittenEventArgs eventData)
        {
            var level = eventData.Level;

            if (level == EventLevel.Error)
            {
                long   keywords     = (long)eventData.Keywords;
                string eventName    = eventData.EventName;
                string eventMessage = FormattingEventListener.CreateFullMessageString(eventData, "error", eventData.Message, m_baseTime, useCustomPipDescription: false);

                // Errors replayed from workers should respect their original event name and keywords
                if (eventData.EventId == (int)SharedLogEventId.DistributionWorkerForwardedError)
                {
                    eventMessage = (string)eventData.Payload[0];
                    eventName    = (string)eventData.Payload[2];
                    keywords     = (long)eventData.Payload[3];
                }

                BucketError(keywords, eventName, eventMessage);
            }
            else
            {
                // OnError() called for an EventLevel other than error?!? How can this be? It is possible for the
                // WarningMapper to upconvert a lower priority event to an error
                Contract.Assert((level == EventLevel.Warning) || (level == EventLevel.Informational) || (level == EventLevel.Verbose));

                string eventMessage = FormattingEventListener.CreateFullMessageString(eventData, "error", eventData.Message, DateTime.Now, useCustomPipDescription: false);
                // The configuration promoted a warning to an error. That's a user error
                UserErrorDetails.RegisterError(eventData.EventName, eventMessage);
            }
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        protected override void OnCritical(EventWrittenEventArgs eventData)
        {
            Contract.Assume(eventData.Level == EventLevel.Critical);
            long   keywords  = (long)eventData.Keywords;
            string eventName = eventData.EventName;

            string eventMessage = FormattingEventListener.CreateFullMessageString(eventData, "error", eventData.Message, m_baseTime, useCustomPipDescription: false);

            BucketError(keywords, eventName, eventMessage);
            Interlocked.Increment(ref m_numCriticals);
        }