Added logging

This commit is contained in:
kolaente 2018-09-19 08:35:53 +02:00
parent 091711f4c5
commit e93cba7108
Signed by untrusted user who does not match committer: konrad
GPG key ID: F40E70337AB24C9B
24 changed files with 1596 additions and 10 deletions

19
models/logging.go Normal file
View file

@ -0,0 +1,19 @@
package models
import (
"github.com/op/go-logging"
"os"
)
var Log = logging.MustGetLogger("vikunja")
var format = logging.MustStringFormatter(
`%{color}%{time:15:04:05.000} %{shortfunc} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`,
)
func InitLogger() {
backend := logging.NewLogBackend(os.Stderr, "", 0)
backendFormatter := logging.NewBackendFormatter(backend, format)
logging.SetBackend(backendFormatter)
}