Compare commits

..

1 Commits

Author SHA1 Message Date
Evan Chen 0f342edffa update 2021-11-11 15:01:29 +08:00
1 changed files with 9 additions and 2 deletions

View File

@ -21,6 +21,14 @@ func New() *kserver {
l := klog.Sub("KSRV")
l.SetPrinter(func(w io.Writer, d *klog.Ldata, l2 *klog.Logger) {
status, ok := d.Fields["Status"].(int)
msg := d.Message
if msg != "" {
msg = l.M(msg, klog.FgRed)
}
stack := d.Stack
if stack != "" {
stack = l.M(stack, klog.FgRed)
}
if !ok {
status = 500
}
@ -30,8 +38,7 @@ func New() *kserver {
StatusColor(status, l),
d.Fields["IP"],
MethodColor(d.Fields["Method"], l),
d.Fields["URL"], l.M(d.Message, klog.FgRed),
l.M(d.Stack, klog.FgRed),
d.Fields["URL"], msg, stack,
)
})