Skip to content

Commit

Permalink
Merge pull request #29 from Nefarion/exceptions
Browse files Browse the repository at this point in the history
Some Exceptions do not give access to .Message
  • Loading branch information
josephwoodward authored Nov 13, 2020
2 parents d675dab + f38d26f commit 5f5aed7
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions src/Serilog.Sinks.Loki/LokiBatchFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,8 @@ public void Format(IEnumerable<LogEvent> logEvents, ITextFormatter formatter, Te
var sb = new StringBuilder();
sb.AppendLine(logEvent.RenderMessage());
if (logEvent.Exception != null)
{
var e = logEvent.Exception;
while (e != null)
{
sb.AppendLine(e.Message);
sb.AppendLine(e.StackTrace);
e = e.InnerException;
}
}
// AggregateException adds a Environment.Newline to the end of ToString(), so we trim it off
sb.AppendLine(logEvent.Exception.ToString().TrimEnd());

foreach (KeyValuePair<string, LogEventPropertyValue> property in logEvent.Properties)
{
Expand Down

0 comments on commit 5f5aed7

Please sign in to comment.