logwrapper

package
v0.0.0-...-65429f0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Info(msg string, fields ...zap.Field)
	Error(msg string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Fatal(msg string, fields ...zap.Field)
	Debug(msg string, fields ...zap.Field)
}

Logger is the interface that wraps the basic logging methods.

type LoggerWrapper

type LoggerWrapper interface {
	SetTraceID(v string) LoggerWrapper
	SetVersion(v string) LoggerWrapper
	CreateSpan() LoggerWrapper
	RemoveSpan() LoggerWrapper
	Logger // interface extends logger
	TraceID() string
	Version() string
	Span() *Span
}

LoggerWrapper is a wrapper for zap.Logger + Span handling

func Mock

func Mock() LoggerWrapper

Mock returns a new mock logger

func New

func New(logger Logger) LoggerWrapper

New returns a new logger

type Span

type Span struct {
	ID string
	// contains filtered or unexported fields
}

type Zap

type Zap struct {
	Logger zap.Logger
}

Zap is a wrapper for zap.Logger

func (*Zap) Debug

func (z *Zap) Debug(msg string, fields ...zap.Field)

Debug logs a message at DebugLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Zap) Error

func (z *Zap) Error(msg string, fields ...zap.Field)

Error logs a message at ErrorLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Zap) Fatal

func (z *Zap) Fatal(msg string, fields ...zap.Field)

Fatal logs a message at FatalLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

The logger then calls os.Exit(1), even if logging at FatalLevel is disabled.

func (*Zap) Info

func (z *Zap) Info(msg string, fields ...zap.Field)

Info logs a message at InfoLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

func (*Zap) Warn

func (z *Zap) Warn(msg string, fields ...zap.Field)

Warn logs a message at WarnLevel. The message includes any fields passed at the log site, as well as any fields accumulated on the logger.

Jump to

Keyboard shortcuts

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