feat(server): Handle creation of a webserver
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
2
commonctx/README.md
Normal file
2
commonctx/README.md
Normal file
@ -0,0 +1,2 @@
|
||||
# Common Context
|
||||
Contain code that will make work with context easier
|
17
commonctx/logger.go
Normal file
17
commonctx/logger.go
Normal file
@ -0,0 +1,17 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user