Documentation ¶
Index ¶
- Constants
- Variables
- func FinalFatal(v interface{})
- func FromContext(ctx context.Context) *zap.SugaredLogger
- func NewDefaultLogger() *zap.SugaredLogger
- func NewLogger(level string, devMode bool) *zap.SugaredLogger
- func SetDefaultConfig(logLevel string, isDevMode bool)
- func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context
- type RequestID
Constants ¶
View Source
const (
RequestIdHeader = "X-Request-Id"
)
Variables ¶
View Source
var ( DefaultLogLevel = levelInfo DefaultIsDevMode = false )
Functions ¶
func FinalFatal ¶
func FinalFatal(v interface{})
func FromContext ¶
func FromContext(ctx context.Context) *zap.SugaredLogger
FromContext returns the logger stored in the context. If no such logger exists, a default logger is returned.
func NewDefaultLogger ¶
func NewDefaultLogger() *zap.SugaredLogger
func NewLogger ¶
func NewLogger(level string, devMode bool) *zap.SugaredLogger
NewLogger returns the logger used across the codebase. The argument "level" specifies the minimum level the logger will write. A zero string means the logger will print debug entries in dev mode; otherwise it prints info entries. See https://pkg.go.dev/go.uber.org/zap#example-package-AdvancedConfiguration for how the zap logger is configured.
func SetDefaultConfig ¶
SetDefaultConfig initializes logging module internal state
func WithLogger ¶
WithLogger creates a new context with the provided logger attached.
Types ¶
Click to show internal directories.
Click to hide internal directories.