Skip to content

Commit

Permalink
tpl: Prepare for template metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
bep committed Aug 19, 2017
1 parent 29a2da0 commit d000cf6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tpl/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ type TemplateAdapter struct {
Template
}

// Execute executes the current template. The actual execution is performed
// by the embedded text or html template, but we add an implementation here so
// we can add a timer for some metrics.
func (t *TemplateAdapter) Execute(w io.Writer, data interface{}) error {
// TODO(moorereason) metrics fmt.Println("Execute:", t.Name())
return t.Template.Execute(w, data)
}

// ExecuteToString executes the current template and returns the result as a
// string.
func (t *TemplateAdapter) ExecuteToString(data interface{}) (string, error) {
Expand Down

0 comments on commit d000cf6

Please sign in to comment.