|
|
|
@ -10,7 +10,7 @@ import (
|
|
|
|
|
"github.com/tal-tech/go-zero/rest/httpx"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const LogContext = "request_logs"
|
|
|
|
|
var LogContext = contextKey("request_logs")
|
|
|
|
|
|
|
|
|
|
type LogCollector struct {
|
|
|
|
|
Messages []string
|
|
|
|
@ -82,3 +82,9 @@ func formatf(r *http.Request, format string, v ...interface{}) string {
|
|
|
|
|
func formatWithReq(r *http.Request, v string) string {
|
|
|
|
|
return fmt.Sprintf("(%s - %s) %s", r.RequestURI, httpx.GetRemoteAddr(r), v)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type contextKey string
|
|
|
|
|
|
|
|
|
|
func (c contextKey) String() string {
|
|
|
|
|
return "rest/internal context key " + string(c)
|
|
|
|
|
}
|
|
|
|
|