gocommon/commonctx/logger.go
Matthieu 'JP' DERASSE 8aedb85605
Some checks failed
continuous-integration/drone/push Build is failing
fix(logger): Move extrafields from gelf to global system
2023-01-09 22:35:26 +00:00

18 lines
337 B
Go

package commonctx
import (
"context"
"github.com/sirupsen/logrus"
)
const LoggerKey = "mainLogger"
func AddMainLogger(ctx context.Context, logger *logrus.Entry) context.Context {
return context.WithValue(ctx, LoggerKey, logger)
}
func GetLogger(ctx context.Context) *logrus.Entry {
return ctx.Value(LoggerKey).(*logrus.Entry)
}