- customisable time format

- custom messages
- configure threshold count instead of uptime %
This commit is contained in:
Matej Kramny
2017-02-05 23:43:38 -08:00
parent b3bc1d4405
commit 0dc54e4e6e
5 changed files with 90 additions and 33 deletions

View File

@@ -1,6 +1,11 @@
package cachet
import "text/template"
import (
"bytes"
"text/template"
"github.com/Sirupsen/logrus"
)
type MessageTemplate struct {
Subject string `json:"subject"`
@@ -33,6 +38,16 @@ func (t *MessageTemplate) Compile() error {
return err
}
func (t *MessageTemplate) Exec(data interface{}) (string, string) {
buf := new(bytes.Buffer)
logrus.Warnf("%#v", t.subjectTpl)
t.subjectTpl.Execute(buf, data)
subject := buf.String()
return subject, ""
}
func compileTemplate(text string) (*template.Template, error) {
return template.New("").Parse(text)
}