improved logging
This commit is contained in:
parent
f8407162ad
commit
05b41cedce
81 changed files with 9802 additions and 279 deletions
|
|
@ -1,16 +1,27 @@
|
|||
// Copyright (C) 2021 Marius Schellenberger
|
||||
// Copyright (C) 2022 Marius Schellenberger
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"git.giftfish.de/ston1th/docstore/pkg/log"
|
||||
"net/http"
|
||||
|
||||
"github.com/go-logr/logr"
|
||||
)
|
||||
|
||||
func webdavLogger(r *http.Request, err error) {
|
||||
if err != nil {
|
||||
log.Printf("webdav: %s %s %s error: %s\n", r.RemoteAddr, r.Method, r.URL, err)
|
||||
return
|
||||
func webdavLogger(log logr.Logger) func(r *http.Request, err error) {
|
||||
return func(r *http.Request, err error) {
|
||||
if err != nil {
|
||||
log.Error(err, "access",
|
||||
"client", r.RemoteAddr,
|
||||
"method", r.Method,
|
||||
"uri", r.URL.Path,
|
||||
)
|
||||
return
|
||||
}
|
||||
log.Info("access",
|
||||
"client", r.RemoteAddr,
|
||||
"method", r.Method,
|
||||
"uri", r.URL.Path,
|
||||
)
|
||||
}
|
||||
log.Printf("webdav: %s %s %s\n", r.RemoteAddr, r.Method, r.URL)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue