gocommon/commonctx/logger.go
Matthieu 'JP' DERASSE 44ff19e779
Some checks failed
continuous-integration/drone/push Build is failing
feat(server): Handle creation of a webserver
2023-01-09 19:44:29 +00:00

18 lines
340 B
Go

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