Provide basic string manupilation functions for template executions.

This change centralizes the template manipulation in a single package
and adds basic string functions to their execution.

Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
David Calavera
2016-03-04 12:29:44 -05:00
parent 44b56341d9
commit 8514880997
9 changed files with 155 additions and 23 deletions

View File

@@ -3,10 +3,10 @@ package loggerutils
import (
"bytes"
"fmt"
"text/template"
"github.com/Sirupsen/logrus"
"github.com/docker/docker/daemon/logger"
"github.com/docker/docker/utils/templates"
)
// ParseLogTag generates a context aware tag for consistency across different
@@ -14,7 +14,7 @@ import (
func ParseLogTag(ctx logger.Context, defaultTemplate string) (string, error) {
tagTemplate := lookupTagTemplate(ctx, defaultTemplate)
tmpl, err := template.New("log-tag").Parse(tagTemplate)
tmpl, err := templates.NewParse("log-tag", tagTemplate)
if err != nil {
return "", err
}