I would simply like to:
1) Use HTML in the email.
2) The email is going to only be for exceptions, so I would like the actual exception message at the top and bold, etc.
4) Output all other items and the call stack.
I cannot achieve #4, looking at the default template - it cannot be achieved - you are dynamically writing out the property items by what exists! I have no way to do 'foreach' loop in the template that I know of, etc...
string FormatDefaultBody(Event<LogEventData> evt) |
| { |
| var body = new StringBuilder(); |
| body.Append("{{@Timestamp}} [{{@Level}}] {{@RenderedMessage}}"); |
|
|
| if (evt.Data.Properties != null) |
| { |
| body.AppendLine(); |
|
|
| foreach (var property in evt.Data.Properties.OrderBy(p => p.Key)) |
| { |
| body.AppendFormat(" {0} = {{{{{1}}}}}", property.Key, property.Key); |
| body.AppendLine(); |
| } |
| } |
|
|
| if (evt.Data.Exception != null) |
| { |
| body.AppendLine(); |
| body.Append("{{@Exception}}"); |
| } |
|
|
| return FormatTemplate(body.ToString(), evt); |
| } |