logging

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const StringJSONEncoderName string = "string_json"

StringJSONEncoderName is used for registering this encoder with zap.

Variables

This section is empty.

Functions

func New

func New(env core.Env)

New ... A helper to create a logger based on environment

func NewContext

func NewContext(ctx context.Context, fields ...zap.Field) context.Context

NewContext ... A helper for middleware to create requestId or other context fields and return a context which logger can understand.

func NewDevelopment

func NewDevelopment() *zap.Logger

NewDevelopment ... A logger for development

func NewLocal

func NewLocal() *zap.Logger

NewLocal ... A logger for local development

func NewProduction

func NewProduction() *zap.Logger

NewProduction ... A logger for production

func NewStringJSONEncoder

func NewStringJSONEncoder(cfg zapcore.EncoderConfig) (zapcore.Encoder, error)

NewStringJSONEncoder returns an encoder that encodes the JSON log dict as a string so the log processing pipeline can correctly process logs with nested JSON.

func NoContext

func NoContext() *zap.Logger

NoContext ... A log helper to log when there's no context. Rare case usage

func WithContext

func WithContext(ctx context.Context) *zap.Logger

WithContext ... Pass in a context containing values to add to each log message

Types

type LogKey

type LogKey = string
const (
	AddrKey LogKey = "address"

	CUUIDKey LogKey = "cuuid"
	PUUIDKey LogKey = "puuid"
	SUUIDKey LogKey = "suuid"
)

ID keys used for logging

Jump to

Keyboard shortcuts

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