update
parent
52501e0d01
commit
f2579ec65a
|
@ -20,10 +20,14 @@ func (k *kserver) GetLogger() *klog.Logger {
|
|||
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)
|
||||
if !ok {
|
||||
status = 500
|
||||
}
|
||||
fmt.Fprintf(w, "[%s] %s |%s| %15s %s %s %s\n%s",
|
||||
l.M("KSRV ", klog.FgHiCyan),
|
||||
d.Time.Format("2006/01/02 15:04:05"),
|
||||
StatusColor(d.Fields["Status"].(int), l),
|
||||
StatusColor(status, l),
|
||||
d.Fields["IP"],
|
||||
MethodColor(d.Fields["Method"], l),
|
||||
d.Fields["URL"], l.M(d.Message, klog.FgRed),
|
||||
|
|
Loading…
Reference in New Issue