log

package
v0.0.0-...-8010d25 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsonEncoder    = "json"
	ConsoleEncoder = "console"

	LowercaseLevelEncoder      = "LowercaseLevelEncoder"
	LowercaseColorLevelEncoder = "LowercaseColorLevelEncoder"
	CapitalLevelEncoder        = "CapitalLevelEncoder"
	CapitalColorLevelEncoder   = "CapitalColorLevelEncoder"

	ShortCallerEncoder = "ShortCallerEncoder"
	FullCallerEncoder  = "FullCallerEncoder"
)

Variables

View Source
var Logger *zap.Logger

Functions

func CustomTimeEncoder

func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

CustomTimeEncoder time format

func Debug

func Debug(msg string, field ...zap.Field)

func Error

func Error(msg string, field ...zap.Field)

func Fatal

func Fatal(msg string, field ...zap.Field)

func GetGormLoggerConfig

func GetGormLoggerConfig() logger.Config

func GetGormZapWriter

func GetGormZapWriter(config logger.Config) (logger.Interface, error)

func Info

func Info(msg string, field ...zap.Field)

func InitLogger

func InitLogger(config Config, serverType consts.ServerType, serviceId string, serverMode consts.ServerMode)

func Sugar

func Sugar() *zap.SugaredLogger

func Warn

func Warn(msg string, field ...zap.Field)

Types

type Config

type Config struct {
	SavePath     string `mapstructure:"savePath"`
	EncoderType  string `mapstructure:"encoderType"`
	EncodeLevel  string `mapstructure:"encodeLevel"`
	EncodeCaller string `mapstructure:"encodeCaller"`
}

type EncoderOptions

type EncoderOptions struct {
	EncoderType  string
	EncodeLevel  string
	EncodeCaller string
}

type GormZapWriter

type GormZapWriter struct {
	logger.Config
	// contains filtered or unexported fields
}

func (*GormZapWriter) Error

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

func (*GormZapWriter) Info

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

func (*GormZapWriter) LogMode

func (w *GormZapWriter) LogMode(level logger.LogLevel) logger.Interface

func (*GormZapWriter) Trace

func (w *GormZapWriter) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*GormZapWriter) Warn

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

Jump to

Keyboard shortcuts

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