2018-11-14 09:18:03 +00:00
|
|
|
package middlewares
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
2022-11-21 17:36:05 +00:00
|
|
|
"github.com/rs/zerolog"
|
|
|
|
"github.com/rs/zerolog/log"
|
|
|
|
"github.com/traefik/traefik/v2/pkg/logs"
|
2018-11-14 09:18:03 +00:00
|
|
|
)
|
|
|
|
|
2022-11-21 17:36:05 +00:00
|
|
|
// 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
|
2018-11-14 09:18:03 +00:00
|
|
|
}
|