Skip to content

Report Templates

Peter van der Woude edited this page Sep 23, 2018 · 9 revisions

Reports come in 3 preset flavors:

  1. Plain Text
  2. HTML
  3. Markdown

These can be selected in configuration via the property ReportTemplateFormat eg

var er = new ExceptionReporter() { Config = { ReportTemplateFormat = TemplateFormat.Text }}

Custom Templates

Custom templates can also be written using Handlebars/Mustache templating engine. To write a custom template you will need to know the variables available. The model used to provide variables can be found in the source code represented by the class ReportModel

The template for plain text (used internally) also serves a complete example.

Application: {{App.Name}}
Version:     {{App.Version}}
Region:      {{App.Region}}
{{#if App.User}}
User:        {{App.User}}
{{/if}}
Date: {{Error.Date}}
Time: {{Error.Time}}
{{#if Error.Explanation}}
User Explanation: {{Error.Explanation}}
{{/if}}

Error Message: {{Error.Message}}
 
[Stack Traces] 
{{Error.FullStackTrace}} 
 
[Assembly References] 
{{#App.AssemblyRefs}}
  {{Name}}, Version={{Version}}
{{/App.AssemblyRefs}}

[System Info] 
{{SystemInfo}}

Clone this wiki locally