feat: init nightly vuls for blackhat

This commit is contained in:
MaineK00n
2022-11-15 11:26:26 +09:00
parent 1d97e91341
commit 3605645ff6
234 changed files with 6172 additions and 54872 deletions

22
pkg/log/log.go Normal file
View File

@@ -0,0 +1,22 @@
package log
import (
"context"
"go.uber.org/zap"
)
type ctxLogger struct{}
// ContextWithLogger adds logger to context
func ContextWithLogger(ctx context.Context, l *zap.Logger) context.Context {
return context.WithValue(ctx, ctxLogger{}, l)
}
// LoggerFromContext returns logger from context
func LoggerFromContext(ctx context.Context) *zap.Logger {
if l, ok := ctx.Value(ctxLogger{}).(*zap.Logger); ok {
return l
}
return zap.L()
}