tpl: Prepare for template metrics - hugo - [fork] hugo port for 9front
HTML git clone git@git.drkhsh.at/hugo.git
DIR Log
DIR Files
DIR Refs
DIR Submodules
DIR README
DIR LICENSE
---
DIR commit d000cf605091c6999b72d6c632752289bc680223
DIR parent 29a2da0593b081cdd61b93c6328af2c9ea4eb20f
HTML Author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Date: Sat, 19 Aug 2017 09:57:37 +0200
tpl: Prepare for template metrics
Diffstat:
M tpl/template.go | 8 ++++++++
1 file changed, 8 insertions(+), 0 deletions(-)
---
DIR diff --git 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) {