示例#1
0
 private static void AppendState(string fieldName, object state, JournalMessage message)
 {
     if (state is IReadOnlyList <KeyValuePair <string, object> > keyValuePairs)
     {
         for (int i = 0; i < keyValuePairs.Count; i++)
         {
             var pair = keyValuePairs[i];
             if (pair.Key == OriginalFormat)
             {
                 continue;
             }
             message.Append(pair.Key, pair.Value);
         }
     }
     else
     {
         message.Append(fieldName, state);
     }
 }
示例#2
0
        private static void FormatException(Exception exception, JournalMessage logMessage)
        {
            logMessage.Append(Exception, exception.Message);
            logMessage.Append(ExceptionType, exception.GetType().FullName);
            logMessage.Append(ExceptionStackTrace, exception.StackTrace);
            Exception innerException = exception.InnerException;

            if (innerException != null)
            {
                logMessage.Append(InnerException, innerException.Message);
                logMessage.Append(InnerExceptionType, innerException.GetType().FullName);
                logMessage.Append(InnerExceptionStackTrace, innerException.StackTrace);
            }
        }