예제 #1
0
        public void LogEvent(int momEventId, string eventMessage)
        {
            ReplicationEvent replicationEvent;

            if (this.m_MomEvents.TryGetValue(momEventId, out replicationEvent))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add another eventId {0}, having logged it already.", momEventId);
                replicationEvent.AddEvent(eventMessage);
                return;
            }
            MomEventInfo eventInfo = null;

            if (!ReplicationEventLookupTable.TryGetReplicationEventInfo(momEventId, out eventInfo))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Couldn't find MOM EventInfo for MOM Event ID {0}.", momEventId);
                return;
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add eventId {0} for the first time.", momEventId);
            replicationEvent = new ReplicationEvent(eventInfo);
            replicationEvent.AddEvent(eventMessage);
            this.m_MomEvents[momEventId] = replicationEvent;
        }
예제 #2
0
        public void LogEvents(CheckId checkId, ReplicationCheckResultEnum result, List <MessageInfo> messages)
        {
            ReplicationEventBaseInfo replicationEventBaseInfo = null;

            if (!ReplicationEventLookupTable.TryGetReplicationEventInfo(checkId, result, out replicationEventBaseInfo))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <CheckId, ReplicationCheckResultEnum>((long)this.GetHashCode(), "LogEvents(): Could not find ReplicationEventBaseInfo for Check '{0}' with Result '{1}'.", checkId, result);
                return;
            }
            if (replicationEventBaseInfo.EventType == ReplicationEventType.Null)
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <CheckId, ReplicationCheckResultEnum>((long)this.GetHashCode(), "LogEvents(): NullEventInfo encountered for check {0} and result {1}. No event will be logged.", checkId, result);
                return;
            }
            if (replicationEventBaseInfo.EventType != ReplicationEventType.MOM)
            {
                if (replicationEventBaseInfo.EventType == ReplicationEventType.AppLog)
                {
                    bool flag = false;
                    Dictionary <string, ReplicationEvent> dictionary = null;
                    if (!this.m_AppLogSingleEvents.TryGetValue((int)checkId, out dictionary))
                    {
                        dictionary = new Dictionary <string, ReplicationEvent>();
                        flag       = true;
                    }
                    foreach (MessageInfo messageInfo in messages)
                    {
                        if (messageInfo.IsTransitioningState)
                        {
                            ReplicationEvent replicationEvent = new ReplicationEvent(replicationEventBaseInfo);
                            replicationEvent.AddEvent(messageInfo.Message);
                            dictionary[messageInfo.InstanceIdentity] = replicationEvent;
                        }
                    }
                    if (flag)
                    {
                        this.m_AppLogSingleEvents[(int)checkId] = dictionary;
                        return;
                    }
                }
                else
                {
                    DiagCore.RetailAssert(false, "Unhandled ReplicationEventType!", new object[0]);
                }
                return;
            }
            int              momEventId   = ((MomEventInfo)replicationEventBaseInfo).MomEventId;
            string           eventMessage = this.BuildErrorMessageForMomEvent(messages);
            ReplicationEvent replicationEvent2;

            if (this.m_MomEvents.TryGetValue(momEventId, out replicationEvent2))
            {
                ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add another eventId {0}, having logged it already.", momEventId);
                replicationEvent2.AddEvent(eventMessage);
                return;
            }
            ExTraceGlobals.HealthChecksTracer.TraceDebug <int>((long)this.GetHashCode(), "LogEvent(): Attempting to add eventId {0} for the first time.", momEventId);
            replicationEvent2 = new ReplicationEvent(replicationEventBaseInfo);
            replicationEvent2.AddEvent(eventMessage);
            this.m_MomEvents[momEventId] = replicationEvent2;
        }
 static ReplicationEventLookupTable()
 {
     ReplicationEventLookupTable.PopulateMomTable();
     ReplicationEventLookupTable.PopulateChecksTable();
 }