Skip to content

Report Templates

Peter van der Woude edited this page Nov 28, 2018 · 9 revisions

Reports can be generated in 3 preset formats:

  1. Plain Text
  2. HTML
  3. Markdown

The format can be chosen via the configuration property ReportTemplateFormat eg

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

Custom Templates

You can also write your own output format using templates written in the Handlebars templating engine. To write a custom template you will need to know the variables available - see the class ReportModel

ReportCustomTemplate = "My Report for {{App.Name}}";

Basically, an object of type [ReportModel] is created and filled by ExceptionReporter before being passed to your custom template. So this class represents all the variables available to your template.

The template for plain text (used internally) also serves as an 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