From d000cf605091c6999b72d6c632752289bc680223 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Sat, 19 Aug 2017 09:57:37 +0200 Subject: tpl: Prepare for template metrics --- tpl/template.go | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'tpl/template.go') diff --git a/tpl/template.go b/tpl/template.go index 02d4a541c..7be496df9 100644 --- a/tpl/template.go +++ b/tpl/template.go @@ -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) { -- cgit v1.2.3