mirror of
https://github.com/containous/traefik.git
synced 2025-01-08 21:17:56 +03:00
20 lines
434 B
Go
20 lines
434 B
Go
package middlewares
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/rs/zerolog"
|
|
"github.com/rs/zerolog/log"
|
|
"github.com/traefik/traefik/v3/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
|
|
}
|