logging

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

func SetDefaultConfig(logLevel string, isDevMode bool)

SetDefaultConfig initializes logging module internal state

func WithLogger

func WithLogger(ctx context.Context, logger *zap.SugaredLogger) context.Context

WithLogger creates a new context with the provided logger attached.

Types

type RequestID

type RequestID string
const RequestIDKey RequestID = "request_id"

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL