logs

package
v1.0.16 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyTraceID   = "trace_id"
	KeyRequestID = "request_id"
	KeyErrorID   = "error_id"
)

Variables

This section is empty.

Functions

func GetZapFieldsForError

func GetZapFieldsForError(err error) []zap.Field

func GetZapFieldsFromContext

func GetZapFieldsFromContext(ctx context.Context) []zap.Field

GetZapFieldsFromContext - Gets any useful zap fields from context TODO: Explore if ctxzap is a better option

func StandardLogger

func StandardLogger() log.Logger

StandardLogger returns a base logger

Types

type LoggerOption

type LoggerOption func(z *ZapLogger)

func WithAsyncFlush

func WithAsyncFlush(duration time.Duration) LoggerOption

func WithEncoderFunc

func WithEncoderFunc(f func(cfg zapcore.EncoderConfig) zapcore.Encoder) LoggerOption

func WithKitLogger

func WithKitLogger(logger log.Logger) LoggerOption

func WithZapLogger

func WithZapLogger(logger *zap.Logger) LoggerOption

type ZapLogger

type ZapLogger struct {
	// contains filtered or unexported fields
}

ZapLogger is go-kit and zap compatible logger

func NewAsyncZapLogger deprecated

func NewAsyncZapLogger(atom zap.AtomicLevel, asyncFlushIntervalMs int, loggerOpts ...LoggerOption) *ZapLogger

NewAsyncZapLogger sets up a async zap global logger and returns gokit compatible logger

Deprecated: Use NewZapLogger with WithAsyncFlush instead.

func NewZapLogger

func NewZapLogger(atom zap.AtomicLevel, loggerOpts ...LoggerOption) *ZapLogger

NewZapLogger sets up a zap global logger and returns gokit compatible logger

func (*ZapLogger) Close

func (z *ZapLogger) Close() error

Close - closing any allocated buffer in zap logger

func (*ZapLogger) GetKitLogger

func (z *ZapLogger) GetKitLogger() log.Logger

GetKitLogger - return gokit compatible logger

func (*ZapLogger) GetZapLogger

func (z *ZapLogger) GetZapLogger() *zap.Logger

GetZapLogger - return zap logger

func (*ZapLogger) L

func (z *ZapLogger) L() *zap.Logger

L - Zap compatible logger function

func (*ZapLogger) Log

func (z *ZapLogger) Log(keyvals ...interface{}) error

Log - Gokit compatible Log function

func (*ZapLogger) S

func (z *ZapLogger) S() *zap.SugaredLogger

S - Zap compatible sugared-logger function

Jump to

Keyboard shortcuts

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