mirror of
https://gitee.com/johng/gf.git
synced 2024-12-02 04:07:47 +08:00
improve color feature for package glog
This commit is contained in:
parent
fae4dea37a
commit
92c3c136f9
@ -9,7 +9,7 @@ package glog
|
||||
import "github.com/gogf/gf/container/gmap"
|
||||
|
||||
const (
|
||||
// Default group name for instance usage.
|
||||
// DefaultName is the default group name for instance usage.
|
||||
DefaultName = "default"
|
||||
)
|
||||
|
||||
|
@ -43,7 +43,6 @@ const (
|
||||
defaultFileExpire = time.Minute
|
||||
pathFilterKey = "/os/glog/glog"
|
||||
memoryLockPrefixForPrintingToFile = "glog.printToFile:"
|
||||
mustWithColor = true
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -19,16 +19,28 @@ const (
|
||||
COLOR_WHITE
|
||||
)
|
||||
|
||||
// Foreground Hi-Intensity text colors
|
||||
const (
|
||||
COLOR_HI_BLACK = 90 + iota
|
||||
COLOR_HI_RED
|
||||
COLOR_HI_GREEN
|
||||
COLOR_HI_YELLOW
|
||||
COLOR_HI_BLUE
|
||||
COLOR_HI_MAGENTA
|
||||
COLOR_HI_CYAN
|
||||
COLOR_HI_WHITE
|
||||
)
|
||||
|
||||
// defaultLevelColor defines the default level and its mapping prefix string.
|
||||
var defaultLevelColor = map[int]int{
|
||||
LEVEL_DEBU: COLOR_YELLOW,
|
||||
LEVEL_INFO: COLOR_GREEN,
|
||||
LEVEL_NOTI: COLOR_CYAN,
|
||||
LEVEL_WARN: COLOR_YELLOW,
|
||||
LEVEL_WARN: COLOR_MAGENTA,
|
||||
LEVEL_ERRO: COLOR_RED,
|
||||
LEVEL_CRIT: COLOR_RED,
|
||||
LEVEL_PANI: COLOR_RED,
|
||||
LEVEL_FATA: COLOR_RED,
|
||||
LEVEL_CRIT: COLOR_HI_RED,
|
||||
LEVEL_PANI: COLOR_HI_RED,
|
||||
LEVEL_FATA: COLOR_HI_RED,
|
||||
}
|
||||
|
||||
// getColoredStr returns a string that is colored by given color.
|
||||
|
Loading…
Reference in New Issue
Block a user