logger

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2021 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(message string)

func Debugf

func Debugf(format string, v ...interface{})

func Error

func Error(message string)

func Errorf

func Errorf(format string, v ...interface{})

func Fatal

func Fatal(message string)

func Fatalf

func Fatalf(format string, v ...interface{})

func Info

func Info(message string)

func Infof

func Infof(format string, v ...interface{})

func InitLogger

func InitLogger(opts ...Option)

InitLogger init Logger

func NewZap

func NewZap(level zapcore.Level, encoderFunc Encoder, w io.Writer, fields ...zap.Field) *zap.Logger

func SetLoggerWriter

func SetLoggerWriter(path string) io.Writer

SetLoggerWriter return Logger writer

func Warn

func Warn(message string)

func Warnf

func Warnf(format string, v ...interface{})

func With

func With(ctx context.Context, opts ...Option) context.Context

With Adds fields.

Types

type Enable

type Enable bool

func (Enable) Apply

func (e Enable) Apply(log *Logger)

type Encoder

type Encoder func(zapcore.EncoderConfig) zapcore.Encoder

type Level

type Level string
const (
	DebugLevel  Level = "DEBUG"
	InfoLevel   Level = "INFO"
	WarnLevel   Level = "WARN"
	ErrorLevel  Level = "ERROR"
	DpanicLevel Level = "DPANIC"
	PanicLevel  Level = "PANIC"
	FatalLevel  Level = "FATAL"
)

func (Level) Apply

func (l Level) Apply(log *Logger)

type LogPath

type LogPath string

func (LogPath) Apply

func (l LogPath) Apply(log *Logger)

type Logger

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

func FromContext

func FromContext(ctx context.Context) *Logger

FromContext Gets the logger from context.

func (*Logger) Debug

func (l *Logger) Debug(message string)

func (*Logger) Debugf

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Error

func (l *Logger) Error(message string)

func (*Logger) Errorf

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Fatal

func (l *Logger) Fatal(message string)

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, v ...interface{})

func (*Logger) Info

func (l *Logger) Info(message string)

func (*Logger) Infof

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Warn

func (l *Logger) Warn(message string)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, v ...interface{})

type Option

type Option interface {
	Apply(*Logger)
}

Jump to

Keyboard shortcuts

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