19 lines
434 B
Go
19 lines
434 B
Go
package middlewares
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/traefik/traefik/v2/pkg/logs"
|
|
)
|
|
|
|
// GetLogger creates a logger with the middleware fields.
|
|
func GetLogger(ctx context.Context, middleware, middlewareType string) *zerolog.Logger {
|
|
logger := log.Ctx(ctx).With().
|
|
Str(logs.MiddlewareName, middleware).
|
|
Str(logs.MiddlewareType, middlewareType).
|
|
Logger()
|
|
|
|
return &logger
|
|
}
|