Ejemplo n.º 1
0
        private static void InternalLogRow(Guid activityId, string assistantShortName, AssistantBase assistant, AssistantsEventType eventType, List <KeyValuePair <string, object> > customData, Guid mailboxGuid)
        {
            if (!AssistantsLog.Instance.Enabled)
            {
                AssistantsLog.Instance.SafeTraceDebug(0L, "Mailbox assistant log is disabled, skip writing to the log file.", new object[0]);
                return;
            }
            if (AssistantsLog.LogDisabledAssistants.Contains(assistantShortName))
            {
                AssistantsLog.Instance.SafeTraceDebug(0L, "Mailbox assistant '{0}' is disabled for logging, skip writing to the log file.", new object[]
                {
                    assistantShortName
                });
                return;
            }
            string text = string.Empty;

            if (assistant != null && assistant.DatabaseInfo != null)
            {
                text = assistant.DatabaseInfo.DatabaseName;
            }
            LogRowFormatter logRowFormatter = new LogRowFormatter(AssistantsLog.Instance.LogSchema);

            if (AssistantsLog.Instance.IsDebugTraceEnabled)
            {
                string text2 = string.Empty;
                if (customData != null)
                {
                    bool flag;
                    text2 = LogRowFormatter.FormatCollection(customData, out flag);
                }
                AssistantsLog.Instance.SafeTraceDebug(0L, "Start writing row to mailbox assistant log: ServerName='{0}', Location='{1}', AssistantName='{2}', ActivityId='{3}', TargetObject='{4}', Event='{5}', CustomData='{6}'", new object[]
                {
                    AssistantsLog.Instance.ServerName,
                    text,
                    assistantShortName,
                    activityId,
                    mailboxGuid,
                    AssistantsLog.stringDictionary[eventType],
                    text2
                });
            }
            logRowFormatter[1] = AssistantsLog.Instance.ServerName;
            logRowFormatter[3] = assistantShortName;
            logRowFormatter[6] = AssistantsLog.stringDictionary[eventType];
            logRowFormatter[2] = text;
            logRowFormatter[7] = customData;
            logRowFormatter[5] = ((mailboxGuid == Guid.Empty) ? string.Empty : mailboxGuid.ToString("D"));
            logRowFormatter[4] = ((activityId == Guid.Empty) ? string.Empty : activityId.ToString("D"));
            AssistantsLog.Append(logRowFormatter);
            AssistantsLog.Instance.SafeTraceDebug(0L, "The above row is written to mailbox assistant log successfully.", new object[0]);
        }
Ejemplo n.º 2
0
        private static void InternalLogAssistantEvent(Guid activityId, AssistantBase assistant, AssistantsEventType eventType, List <KeyValuePair <string, object> > customData, Guid mailboxGuid)
        {
            string assistantShortName = (assistant == null) ? "Unknown" : assistant.NonLocalizedName;

            AssistantsLog.InternalLogRow(activityId, assistantShortName, assistant, eventType, customData, mailboxGuid);
        }