logger

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v1.4.0

type Config struct {
	ZapConfig zap.Config        `json:"zap_config" yaml:"zap_config"`
	LogRotate lumberjack.Logger `json:"log_rotate" yaml:"log_rotate"`
}

Config represents the setting for zap logger.

type Logger

type Logger struct {
	Zap *zap.SugaredLogger
}

Logger is an alternative implementation of *gorm.Logger

func NewLogger added in v1.4.0

func NewLogger(env string) *Logger

NewLogger create logger object for *gorm.DB from *echo.Logger

func (*Logger) Error added in v1.5.2

func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})

Error prints a error log.

func (*Logger) GetZapLogger added in v1.5.0

func (log *Logger) GetZapLogger() *zap.SugaredLogger

GetZapLogger returns zapSugaredLogger

func (*Logger) Info added in v1.5.2

func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})

Info prints a information log.

func (*Logger) LogMode added in v1.5.2

func (l *Logger) LogMode(level gormLogger.LogLevel) gormLogger.Interface

LogMode: The log level of gorm logger is overwrited by the log level of Zap logger.

func (*Logger) Trace added in v1.5.2

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)

Trace prints a trace log such as sql, source file and error.

func (*Logger) Warn added in v1.5.2

func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})

Warn prints a warning log.

Jump to

Keyboard shortcuts

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