Exemplo n.º 1
0
 private static void AddToMessage(GelfMessage gelfMessage, IDictionary messageObject)
 {
     foreach (DictionaryEntry entry in messageObject)
     {
         var key   = (entry.Key ?? string.Empty).ToString();
         var value = (entry.Value ?? string.Empty).ToString();
         if (FullMessageKeyValues.Contains(key, StringComparer.OrdinalIgnoreCase))
         {
             gelfMessage.FullMessage = value;
         }
         else if (ShortMessageKeyValues.Contains(key, StringComparer.OrdinalIgnoreCase))
         {
             gelfMessage.ShortMessage = value.TruncateMessage(ShortMessageLength);
         }
         else
         {
             key = key.StartsWith("_") ? key : "_" + key;
             gelfMessage[key] = FormatAdditionalField(entry.Value);
         }
     }
 }
Exemplo n.º 2
0
 private void AddToMessage(GelfMessage gelfMessage, IDictionary messageObject)
 {
     foreach (DictionaryEntry entry in messageObject as IDictionary)
     {
         var key   = (entry.Key ?? string.Empty).ToString();
         var value = (entry.Value ?? string.Empty).ToString();
         if (FullMessageKeyValues.Contains(key, StringComparer.OrdinalIgnoreCase))
         {
             gelfMessage.FullMessage = value;
         }
         else if (ShortMessageKeyValues.Contains(key, StringComparer.OrdinalIgnoreCase))
         {
             gelfMessage.ShortMessage = value.TruncateMessage(SHORT_MESSAGE_LENGTH);
         }
         else
         {
             key = key.StartsWith("_") ? key : "_" + key;
             gelfMessage[key] = value;
         }
     }
 }