summaryrefslogtreecommitdiffstats
path: root/utils/html.go
diff options
context:
space:
mode:
Diffstat (limited to 'utils/html.go')
-rw-r--r--utils/html.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/utils/html.go b/utils/html.go
index f9a7abe5b..0de33435d 100644
--- a/utils/html.go
+++ b/utils/html.go
@@ -6,14 +6,15 @@ package utils
import (
"bytes"
"errors"
+ "fmt"
"html/template"
"io"
"path/filepath"
"reflect"
"sync/atomic"
- l4g "github.com/alecthomas/log4go"
"github.com/fsnotify/fsnotify"
+ "github.com/mattermost/mattermost-server/mlog"
"github.com/nicksnyder/go-i18n/i18n"
)
@@ -25,7 +26,7 @@ type HTMLTemplateWatcher struct {
func NewHTMLTemplateWatcher(directory string) (*HTMLTemplateWatcher, error) {
templatesDir, _ := FindDir(directory)
- l4g.Debug("Parsing server templates at %v", templatesDir)
+ mlog.Debug(fmt.Sprintf("Parsing server templates at %v", templatesDir))
ret := &HTMLTemplateWatcher{
stop: make(chan struct{}),
@@ -57,15 +58,15 @@ func NewHTMLTemplateWatcher(directory string) (*HTMLTemplateWatcher, error) {
return
case event := <-watcher.Events:
if event.Op&fsnotify.Write == fsnotify.Write {
- l4g.Info("Re-parsing templates because of modified file %v", event.Name)
+ mlog.Info(fmt.Sprintf("Re-parsing templates because of modified file %v", event.Name))
if htmlTemplates, err := template.ParseGlob(filepath.Join(templatesDir, "*.html")); err != nil {
- l4g.Error("Failed to parse templates %v", err)
+ mlog.Error(fmt.Sprintf("Failed to parse templates %v", err))
} else {
ret.templates.Store(htmlTemplates)
}
}
case err := <-watcher.Errors:
- l4g.Error("Failed in directory watcher %s", err)
+ mlog.Error(fmt.Sprintf("Failed in directory watcher %s", err))
}
}
}()
@@ -110,7 +111,7 @@ func (t *HTMLTemplate) RenderToWriter(w io.Writer) error {
}
if err := t.Templates.ExecuteTemplate(w, t.TemplateName, t); err != nil {
- l4g.Error(T("api.api.render.error"), t.TemplateName, err)
+ mlog.Error(fmt.Sprintf("Error rendering template %v err=%v", t.TemplateName, err))
return err
}
@@ -134,7 +135,7 @@ func escapeForHtml(arg interface{}) interface{} {
}
return safeArg
default:
- l4g.Warn("Unable to escape value for HTML template %v of type %v", arg, reflect.ValueOf(arg).Type())
+ mlog.Warn(fmt.Sprintf("Unable to escape value for HTML template %v of type %v", arg, reflect.ValueOf(arg).Type()))
return ""
}
}