rename handlerlog to handlerctx
This commit is contained in:
parent
83dfcba4ae
commit
e14bcb205b
@ -11,7 +11,7 @@ import (
|
||||
|
||||
cacheproxy "git.jeffthecoder.xyz/guochao/cache-proxy"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/handlerlog"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/handlerctx"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/httplog"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/recover"
|
||||
|
||||
@ -133,7 +133,7 @@ func main() {
|
||||
slog.With("addr", ":8881").Info("serving app")
|
||||
if err := http.ListenAndServe(":8881", middleware.Use(mux,
|
||||
recover.Recover(),
|
||||
handlerlog.FindHandler(mux),
|
||||
handlerctx.FindHandler(mux),
|
||||
httplog.Log(httplog.Config{LogStart: true, LogFinish: true}),
|
||||
)); err != nil {
|
||||
slog.With("error", err).Error("failed to start server")
|
||||
|
@ -1,4 +1,4 @@
|
||||
package handlerlog
|
||||
package handlerctx
|
||||
|
||||
import (
|
||||
"context"
|
@ -6,7 +6,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/handlerlog"
|
||||
"git.jeffthecoder.xyz/guochao/cache-proxy/pkgs/middleware/handlerctx"
|
||||
)
|
||||
|
||||
type ctxKey int
|
||||
@ -43,7 +43,7 @@ func Log(config Config) func(http.Handler) http.Handler {
|
||||
"path", r.URL.Path,
|
||||
}
|
||||
|
||||
if pattern, handlerFound := handlerlog.Pattern(r); handlerFound {
|
||||
if pattern, handlerFound := handlerctx.Pattern(r); handlerFound {
|
||||
args = append(args, "handler", pattern)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user