Compare commits

..

1 Commits

Author SHA1 Message Date
Evan Chen 46da048856 update 2021-11-11 14:46:59 +08:00
1 changed files with 2 additions and 9 deletions

View File

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