Compare commits

...

1 Commits

Author SHA1 Message Date
Evan Chen 5dea4a8bc5 update 2021-11-01 22:41:11 +08:00
1 changed files with 13 additions and 10 deletions

23
log.go
View File

@ -96,16 +96,19 @@ func NewLogFormater() *LogFormater {
func (l *logger) SetTmpl(tmpl *LogFormater) error { func (l *logger) SetTmpl(tmpl *LogFormater) error {
funcMap := template.FuncMap{ funcMap := template.FuncMap{
"Time": func() string { return time.Now().Format("2006/01/02 15:04:05") }, "Time": func() string { return time.Now().Format("2006/01/02 15:04:05") },
"red": func() string { return "\033[91m" }, // "red": func() string { return "\033[91m" },
"redl": func() string { return "\033[31m" }, // "redl": func() string { return "\033[31m" },
"green": func() string { return "\033[92m" }, // "green": func() string { return "\033[92m" },
"yellow": func() string { return "\033[93m" }, // "yellow": func() string { return "\033[93m" },
"blue": func() string { return "\033[94m" }, // "blue": func() string { return "\033[94m" },
"magenta": func() string { return "\033[95m" }, // "magenta": func() string { return "\033[95m" },
"cyan": func() string { return "\033[96m" }, // "cyan": func() string { return "\033[96m" },
"white": func() string { return "\033[97m" }, // "white": func() string { return "\033[97m" },
"reset": func() string { return "\033[0m" }, // "reset": func() string { return "\033[0m" },
}
if l.color {
} }
err_tmpl, err := template.New("err_tmpl").Funcs(funcMap).Parse(tmpl.ErrTmplStr) err_tmpl, err := template.New("err_tmpl").Funcs(funcMap).Parse(tmpl.ErrTmplStr)
if err != nil { if err != nil {