fix: logger and context.
This commit is contained in:
parent
b4c7b90c9e
commit
8e18d37b3d
52 changed files with 231 additions and 183 deletions
|
@ -4,10 +4,9 @@ import (
|
|||
"context"
|
||||
|
||||
"github.com/containous/traefik/v2/pkg/log"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
// GetLogger creates a logger configured with the middleware fields.
|
||||
func GetLogger(ctx context.Context, middleware string, middlewareType string) logrus.FieldLogger {
|
||||
return log.FromContext(ctx).WithField(log.MiddlewareName, middleware).WithField(log.MiddlewareType, middlewareType)
|
||||
// GetLoggerCtx creates a logger context with the middleware fields.
|
||||
func GetLoggerCtx(ctx context.Context, middleware string, middlewareType string) context.Context {
|
||||
return log.With(ctx, log.Str(log.MiddlewareName, middleware), log.Str(log.MiddlewareType, middlewareType))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue