Logging config

This commit is contained in:
simon987
2019-01-14 18:37:05 -05:00
parent ef333b6b25
commit 0346dd8b6b
7 changed files with 22 additions and 17 deletions

View File

@@ -4,6 +4,7 @@ import (
"errors"
"github.com/Sirupsen/logrus"
"github.com/valyala/fasthttp"
"src/task_tracker/config"
"time"
)
@@ -33,7 +34,7 @@ func LogRequest(h RequestHandler) fasthttp.RequestHandler {
}
func SetupLogger() {
logrus.SetLevel(logrus.TraceLevel) //todo: from conf
logrus.SetLevel(config.Cfg.LogLevel)
}
func parseLogEntry(r *Request) *LogEntry {
@@ -88,4 +89,3 @@ func LogError(r *Request) {
"scope": entry.Scope,
}).WithTime(entry.Time()).Error(entry.Message)
}