마지막 활동 1 month ago

mila 이 gist를 수정했습니다 2 years ago. 리비전으로 이동

변경 사항 없음

mila 이 gist를 수정했습니다 2 years ago. 리비전으로 이동

1 file changed, 2 insertions

gistfile1.txt 이름 변경됨 http-metrics.go

@@ -1,5 +1,7 @@
1 1 import "github.com/felixge/httpsnoop"
2 2
3 + handler := http.StripPrefix("/path/", http.FileServer(http.Dir("/tmp/files/")))
4 +
3 5 wrappedHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
4 6 metrics := httpsnoop.CaptureMetrics(handler, w, r)
5 7 slog.Info(fmt.Sprintf("%v %v", r.Method, r.URL), "code", metrics.Code)

mila 이 gist를 수정했습니다 2 years ago. 리비전으로 이동

1 file changed, 6 insertions

gistfile1.txt(파일 생성됨)

@@ -0,0 +1,6 @@
1 + import "github.com/felixge/httpsnoop"
2 +
3 + wrappedHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
4 + metrics := httpsnoop.CaptureMetrics(handler, w, r)
5 + slog.Info(fmt.Sprintf("%v %v", r.Method, r.URL), "code", metrics.Code)
6 + })
다음 항목 이전 항목