logger

package
v0.0.0-...-1b8de1e Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRequestID

func AddRequestID(ctx context.Context, logger *zap.Logger) *zap.Logger

AddRequestID sets requestID field from context to logger and returns it

func ContextValue

func ContextValue(ctx context.Context, fallbacks ...*zap.Logger) *zap.Logger

ContextValue retrieves logger from given context or falls back to any of the logger passed to it. If no loggers are found it uses default logger from pkg/logger

func ContextWithValue

func ContextWithValue(ctx context.Context, logger *zap.Logger) context.Context

ContextWithValue allows us to pack custom logger to context and pass that to the

func Debug

func Debug(opt *options.LogOpt) (*zap.Logger, error)

Debug prepares debug logger using options

func DebugBufferedLogger

func DebugBufferedLogger(out *rr) *debugBufferingLogger

DebugBufferedLogger provides buffered logger compatible with zap.

func Default

func Default() *zap.Logger

func Init

func Init()

Init (re)initializes global logger according to the settings

It also peaks into http-server options to determinate if log events should be buffered for use from web console

func LogParamError

func LogParamError(name string, r *http.Request, err error)

LogParamError for loggin invalid params

func Make

func Make(opt *options.LogOpt) (logger *zap.Logger, err error)

Make creates a logger (debug or production) according to options

func MakeDebugLogger

func MakeDebugLogger() *zap.Logger

MakeDebugLogger creates a logger

func Mask

func Mask(key string, val interface{}) zap.Field

Mask is a passthrough for MaskIf

func MaskIf

func MaskIf(key string, val interface{}, mask bool) zap.Field

MaskIf conditionally masks (replaces string with * of equal length input string/stringer

func Must

func Must(logger *zap.Logger, err error) *zap.Logger

Must is a utility function that panics if given log maker returns an error

func Production

func Production(opt *options.LogOpt) (*zap.Logger, error)

func SetDefault

func SetDefault(logger *zap.Logger)

func Uint64

func Uint64(k string, id uint64) zap.Field

Uint64 properly encodes values to be represented in the web console

func Uint64s

func Uint64s(k string, id []uint64) zap.Field

Uint64s properly encodes values to be represented in the web console

func WriteLogBuffer

func WriteLogBuffer(w io.Writer, after, limit int) (_ int, err error)

WriteLogBuffer provides access to default debug log buffer

Types

This section is empty.

Jump to

Keyboard shortcuts

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