summaryrefslogtreecommitdiff
path: root/logging
diff options
context:
space:
mode:
Diffstat (limited to 'logging')
-rw-r--r--logging/middleware.go16
1 files changed, 8 insertions, 8 deletions
diff --git a/logging/middleware.go b/logging/middleware.go
index 693cb2f..2d0e5b9 100644
--- a/logging/middleware.go
+++ b/logging/middleware.go
@@ -8,12 +8,12 @@ import (
"io"
"time"
- sr "tildegit.org/tjp/sliderule"
+ "tildegit.org/tjp/sliderule/internal/types"
)
-func LogRequests(logger Logger) sr.Middleware {
- return func(inner sr.Handler) sr.Handler {
- return sr.HandlerFunc(func(ctx context.Context, request *sr.Request) *sr.Response {
+func LogRequests(logger Logger) types.Middleware {
+ return func(inner types.Handler) types.Handler {
+ return types.HandlerFunc(func(ctx context.Context, request *types.Request) *types.Response {
start := time.Now()
response := inner.Handle(ctx, request)
if response != nil {
@@ -38,7 +38,7 @@ func LogRequests(logger Logger) sr.Middleware {
}
}
-func clientFingerprint(request *sr.Request) (string, bool) {
+func clientFingerprint(request *types.Request) (string, bool) {
if request.TLSState == nil || len(request.TLSState.PeerCertificates) == 0 {
return "", false
}
@@ -48,8 +48,8 @@ func clientFingerprint(request *sr.Request) (string, bool) {
}
type loggedResponseBody struct {
- request *sr.Request
- response *sr.Response
+ request *types.Request
+ response *types.Response
body io.Reader
start time.Time
@@ -111,7 +111,7 @@ func (lwtr loggedWriteToResponseBody) WriteTo(dst io.Writer) (int64, error) {
return n, err
}
-func loggingBody(logger Logger, request *sr.Request, response *sr.Response, start time.Time) io.Reader {
+func loggingBody(logger Logger, request *types.Request, response *types.Response, start time.Time) io.Reader {
body := &loggedResponseBody{
request: request,
response: response,