Refactor Logger (#13294)

Refactor Logger to make a logger interface and make it possible to
wrap loggers for specific purposes.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
zeripath
2020-10-31 05:36:46 +00:00
committed by GitHub
parent ffc8ce7bae
commit 47dd1cb7ae
9 changed files with 215 additions and 116 deletions

View File

@ -158,15 +158,15 @@ func ColorBytes(attrs ...ColorAttribute) []byte {
return bytes
}
var levelToColor = map[Level]string{
TRACE: ColorString(Bold, FgCyan),
DEBUG: ColorString(Bold, FgBlue),
INFO: ColorString(Bold, FgGreen),
WARN: ColorString(Bold, FgYellow),
ERROR: ColorString(Bold, FgRed),
CRITICAL: ColorString(Bold, BgMagenta),
FATAL: ColorString(Bold, BgRed),
NONE: ColorString(Reset),
var levelToColor = map[Level][]byte{
TRACE: ColorBytes(Bold, FgCyan),
DEBUG: ColorBytes(Bold, FgBlue),
INFO: ColorBytes(Bold, FgGreen),
WARN: ColorBytes(Bold, FgYellow),
ERROR: ColorBytes(Bold, FgRed),
CRITICAL: ColorBytes(Bold, BgMagenta),
FATAL: ColorBytes(Bold, BgRed),
NONE: ColorBytes(Reset),
}
var resetBytes = ColorBytes(Reset)