-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlogging.go
33 lines (27 loc) · 928 Bytes
/
logging.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2020 CleverGo. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file.
package middleware
import (
"io"
"net/http"
"github.com/gorilla/handlers"
)
// Logging is a logging middleware.
func Logging(out io.Writer) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return handlers.LoggingHandler(out, next)
}
}
// CombinedLogging is a combined logging middleware.
func CombinedLogging(out io.Writer) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return handlers.CombinedLoggingHandler(out, next)
}
}
// CustomerLogging is a customer logging middleware.
func CustomerLogging(out io.Writer, formatter handlers.LogFormatter) func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return handlers.CustomLoggingHandler(out, next, formatter)
}
}