示例#1
0
        private static void LogEvent(ProtocolLog.Component component, ProtocolLog.EventType eventType, LoggingContext loggingContext, string data, Exception exception)
        {
            if (string.IsNullOrEmpty(data))
            {
                throw new ArgumentNullException("data");
            }
            ProtocolLog.InitializeIfNeeded();
            LogRowFormatter logRowFormatter = new LogRowFormatter(ProtocolLog.LogSchema);

            logRowFormatter[1] = component;
            logRowFormatter[2] = eventType;
            if (loggingContext != null)
            {
                logRowFormatter[5] = loggingContext.MailboxGuid.ToString();
                logRowFormatter[3] = loggingContext.TransactionId.ToString();
                logRowFormatter[4] = loggingContext.User;
                logRowFormatter[6] = loggingContext.Context;
            }
            logRowFormatter[7] = data;
            if (exception != null)
            {
                List <string> list  = null;
                List <string> list2 = null;
                string        value = null;
                ProtocolLog.GetExceptionTypeAndDetails(exception, out list, out list2, out value, false);
                logRowFormatter[8] = list[0];
                logRowFormatter[9] = list2[0];
                if (list.Count > 1)
                {
                    logRowFormatter[10] = list[list.Count - 1];
                    logRowFormatter[11] = list2[list2.Count - 1];
                }
                logRowFormatter[12] = value;
            }
            ProtocolLog.instance.logInstance.Append(logRowFormatter, 0);
            if (loggingContext != null && loggingContext.LoggingStream != null)
            {
                try
                {
                    logRowFormatter.Write(loggingContext.LoggingStream);
                }
                catch (StorageTransientException)
                {
                }
                catch (StoragePermanentException)
                {
                }
            }
        }
示例#2
0
 public static void LogStatistics(ProtocolLog.Component component, LoggingContext loggingContext, string data)
 {
     ProtocolLog.LogEvent(component, ProtocolLog.EventType.Statistics, loggingContext, data, null);
 }
示例#3
0
 public static void LogCycleFailure(ProtocolLog.Component component, LoggingContext loggingContext, string data, Exception exception)
 {
     ProtocolLog.LogEvent(component, ProtocolLog.EventType.CycleFailure, loggingContext, data, exception);
 }
示例#4
0
 public static void LogCycleSuccess(ProtocolLog.Component component, LoggingContext loggingContext, string data)
 {
     ProtocolLog.LogEvent(component, ProtocolLog.EventType.CycleSuccess, loggingContext, data, null);
 }
示例#5
0
 public static void LogInformation(ProtocolLog.Component component, LoggingContext loggingContext, string data)
 {
     ProtocolLog.LogEvent(component, ProtocolLog.EventType.Information, loggingContext, data, null);
 }
示例#6
0
 public static void LogError(ProtocolLog.Component component, LoggingContext loggingContext, string data, Exception exception)
 {
     ProtocolLog.LogEvent(component, ProtocolLog.EventType.Error, loggingContext, data, exception);
 }