logger

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logger contains logging implementations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	// These are ops that call directly to the actual zap implementation
	Debug(string, ...zap.Field)
	Info(string, ...zap.Field)
	Warn(string, ...zap.Field)
	Error(string, ...zap.Field)
	Panic(string, ...zap.Field)
	Fatal(string, ...zap.Field)

	// These are the equivalent logger function but with context provided
	DebugWithContext(context.Context, string, ...zap.Field)
	InfoWithContext(context.Context, string, ...zap.Field)
	WarnWithContext(context.Context, string, ...zap.Field)
	ErrorWithContext(context.Context, string, ...zap.Field)
	PanicWithContext(context.Context, string, ...zap.Field)
	FatalWithContext(context.Context, string, ...zap.Field)
}

type OptionLogger added in v1.5.1

type OptionLogger func(ol *OptionsLogger)

func WithFormat added in v1.5.1

func WithFormat(format string) OptionLogger

func WithLevel added in v1.5.1

func WithLevel(level string) OptionLogger

func WithTimestampFormat added in v1.5.1

func WithTimestampFormat(timestampFormat string) OptionLogger

type OptionsLogger added in v1.5.1

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

OptionsLogger Implements options for logger

type ZapLogger

type ZapLogger struct {
	*zap.Logger
}

ZapLogger is an implementation of Logger that uses the uber/zap logger underneath. It provides additional methods such as ones that logs based on context.

func MustNewLogger added in v0.3.1

func MustNewLogger(logFormat, logLevel, logTimestampFormat string) *ZapLogger

func NewLogger added in v0.3.1

func NewLogger(options ...OptionLogger) (*ZapLogger, error)

func NewNoopLogger

func NewNoopLogger() *ZapLogger

NewNoopLogger provides a noop logger.

func (*ZapLogger) Debug

func (l *ZapLogger) Debug(msg string, fields ...zap.Field)

func (*ZapLogger) DebugWithContext

func (l *ZapLogger) DebugWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) Error

func (l *ZapLogger) Error(msg string, fields ...zap.Field)

func (*ZapLogger) ErrorWithContext

func (l *ZapLogger) ErrorWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) Fatal

func (l *ZapLogger) Fatal(msg string, fields ...zap.Field)

func (*ZapLogger) FatalWithContext

func (l *ZapLogger) FatalWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) Info

func (l *ZapLogger) Info(msg string, fields ...zap.Field)

func (*ZapLogger) InfoWithContext

func (l *ZapLogger) InfoWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) Panic

func (l *ZapLogger) Panic(msg string, fields ...zap.Field)

func (*ZapLogger) PanicWithContext

func (l *ZapLogger) PanicWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) Warn

func (l *ZapLogger) Warn(msg string, fields ...zap.Field)

func (*ZapLogger) WarnWithContext

func (l *ZapLogger) WarnWithContext(ctx context.Context, msg string, fields ...zap.Field)

func (*ZapLogger) With

func (l *ZapLogger) With(fields ...zap.Field)

Jump to

Keyboard shortcuts

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