diff --git a/kserver.go b/kserver.go index 77b92cb..19332f4 100644 --- a/kserver.go +++ b/kserver.go @@ -69,7 +69,7 @@ func New() *kserver { } k := &kserver{ l: l, - nolog: func(r *http.Request) bool { return true }, + nolog: func(r *http.Request) bool { return false }, } return k } @@ -95,7 +95,7 @@ func (k *kserver) catch(rw *responseWriter, r *http.Request) { k.l.ErrorF(log.H{"Status": rw.StatueCode, "IP": GetIP(r), "Method": r.Method, "URL": r.URL.Path, "Agent": r.Header.Get("User-Agent")}, ex) } else if rw.StatueCode >= 500 { k.l.ErrorF(log.H{"Status": rw.StatueCode, "IP": GetIP(r), "Method": r.Method, "URL": r.URL.Path, "Agent": r.Header.Get("User-Agent")}, rw.err) - } else if k.nolog != nil && k.nolog(r) { + } else if k.nolog == nil || !k.nolog(r) { k.l.InfoF(log.H{"Status": rw.StatueCode, "IP": GetIP(r), "Method": r.Method, "URL": r.URL.Path, "Agent": r.Header.Get("User-Agent")}) } }