logger

package
v0.0.0-...-21f8c24 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppLogger

type AppLogger struct {
	Level    string
	DevMode  bool
	Encoding string
	// contains filtered or unexported fields
}

Application logger

func NewAppLogger

func NewAppLogger(cfg *Config) *AppLogger

NewAppLogger App Logger constructor

func (*AppLogger) DPanic

func (l *AppLogger) DPanic(args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func (*AppLogger) DPanicf

func (l *AppLogger) DPanicf(template string, args ...interface{})

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func (*AppLogger) Debug

func (l *AppLogger) Debug(args ...interface{})

Debug uses fmt.Sprint to construct and log a message.

func (*AppLogger) Debugf

func (l *AppLogger) Debugf(template string, args ...interface{})

Debugf uses fmt.Sprintf to log a templated message

func (*AppLogger) Err

func (l *AppLogger) Err(msg string, err error)

Err uses error to log a message.

func (*AppLogger) Error

func (l *AppLogger) Error(args ...interface{})

Error uses fmt.Sprint to construct and log a message.

func (*AppLogger) Errorf

func (l *AppLogger) Errorf(template string, args ...interface{})

Errorf uses fmt.Sprintf to log a templated message.

func (*AppLogger) Fatal

func (l *AppLogger) Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then calls os.Exit.

func (*AppLogger) Fatalf

func (l *AppLogger) Fatalf(template string, args ...interface{})

Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.

func (*AppLogger) Info

func (l *AppLogger) Info(args ...interface{})

Info uses fmt.Sprint to construct and log a message

func (*AppLogger) Infof

func (l *AppLogger) Infof(template string, args ...interface{})

Infof uses fmt.Sprintf to log a templated message.

func (*AppLogger) InitLogger

func (l *AppLogger) InitLogger()

InitLogger Init logger

func (*AppLogger) Logger

func (l *AppLogger) Logger() *zap.Logger

func (*AppLogger) Panic

func (l *AppLogger) Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func (*AppLogger) Panicf

func (l *AppLogger) Panicf(template string, args ...interface{})

Panicf uses fmt.Sprintf to log a templated message, then panics

func (*AppLogger) Printf

func (l *AppLogger) Printf(template string, args ...interface{})

Printf uses fmt.Sprintf to log a templated message

func (*AppLogger) SugarLogger

func (l *AppLogger) SugarLogger() *zap.SugaredLogger

func (*AppLogger) Sync

func (l *AppLogger) Sync() error

Sync flushes any buffered log entries

func (*AppLogger) Warn

func (l *AppLogger) Warn(args ...interface{})

Warn uses fmt.Sprint to construct and log a message.

func (*AppLogger) WarnMsg

func (l *AppLogger) WarnMsg(msg string, err error)

WarnMsg log error message with warn Level.

func (*AppLogger) Warnf

func (l *AppLogger) Warnf(template string, args ...interface{})

Warnf uses fmt.Sprintf to log a templated message.

func (*AppLogger) WithName

func (l *AppLogger) WithName(name string)

WithName add logger microservice name

type Config

type Config struct {
	LogLevel string `env:"LOGGER_LEVEL" envDefault:"info"`
	DevMode  bool   `env:"LOGGER_DEV_MODE" envDefault:"false"`
	Encoder  string `env:"LOGGER_ENCODER" envDefault:"console"`
}

type Logger

type Logger interface {
	InitLogger()
	Sync() error
	Logger() *zap.Logger
	SugarLogger() *zap.SugaredLogger
	Debug(args ...interface{})
	Debugf(template string, args ...interface{})
	Info(args ...interface{})
	Infof(template string, args ...interface{})
	Warn(args ...interface{})
	Warnf(template string, args ...interface{})
	WarnMsg(msg string, err error)
	Error(args ...interface{})
	Errorf(template string, args ...interface{})
	Err(msg string, err error)
	DPanic(args ...interface{})
	DPanicf(template string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(template string, args ...interface{})
	Printf(template string, args ...interface{})
	WithName(name string)
}

Logger methods interface

Jump to

Keyboard shortcuts

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