summaryrefslogtreecommitdiffstats
path: root/utils/html.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-04-27 14:12:01 -0700
committerChristopher Speller <crspeller@gmail.com>2018-04-27 14:12:01 -0700
commiteb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa (patch)
treeed01fd9488bd86f6c2daf0b299dff5beb43973db /utils/html.go
parent2386acb3ddabd8827e21b1862c338a8b13a25de6 (diff)
parent2e6b3da1d3466db379fef0d61a23e2878d17ee9d (diff)
downloadchat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.tar.gz
chat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.tar.bz2
chat-eb9ff34fcfa51cd8205841a02f3d3d61ec5be8fa.zip
Merge branch 'master' into advanced-permissions-phase-2
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 ""
}
}