logger

package
v0.0.0-...-9e30f45 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *logrus.Logger

Logger 全局logger

View Source
var LoggerContextMgr = gls.NewContextManager()

LoggerContextMgr gls 全局上下文管理器

Functions

func Debug

func Debug(ctx context.Context, format string, args ...interface{})

Debug debug

@param ctx
@param format
@param args

func Debugs

func Debugs(format string, args ...interface{})

Debugs debug

@param ctx
@param format
@param args

func Error

func Error(ctx context.Context, format string, args ...interface{})

Error error

@param ctx
@param format
@param args

func Errors

func Errors(format string, args ...interface{})

Errors error

@param ctx
@param format
@param args

func GetLogLevel

func GetLogLevel() logrus.Level

GetLogLevel 获取日志等级

@return logrus.Level

func GetOutput

func GetOutput() io.Writer

GetOutput 获取写io

@return io.Writer

func GetTraceID

func GetTraceID(ctx context.Context) string

GetTraceID 获取追踪ID

@param ctx
@return string

func Info

func Info(ctx context.Context, format string, args ...interface{})

Info info

@param ctx
@param format
@param args

func Infos

func Infos(format string, args ...interface{})

Infos info

@param ctx
@param format
@param args

func InitLogger

func InitLogger(filePath, logLevel, serverName string)

InitLogger 初始化日志

@param filePath
@param logLevel
@param serverName

func NewGinLogger

func NewGinLogger() gin.HandlerFunc

NewGinLogger 获取gin loggger

@return gin.HandlerFunc

func Paninc

func Paninc(ctx context.Context, format string, args ...interface{})

Paninc panic

@param ctx
@param format
@param args

func Panincs

func Panincs(format string, args ...interface{})

Panincs panic

@param ctx
@param format
@param args

func Warn

func Warn(ctx context.Context, format string, args ...interface{})

Warn warn

@param ctx
@param format
@param args

func Warns

func Warns(format string, args ...interface{})

Warns warn

@param ctx
@param format
@param args

Types

type CmdbLoggerContext

type CmdbLoggerContext struct {
	Username string
	UserID   int64
	TraceID  string
}

CmdbLoggerContext cmd

type GlsHook

type GlsHook struct{}

GlsHook gls hook

func (*GlsHook) Fire

func (h *GlsHook) Fire(e *logrus.Entry) error

Fire fire

@receiver h
@param e
@return error

func (*GlsHook) Levels

func (h *GlsHook) Levels() []logrus.Level

Levels level

@receiver h
@return []logrus.Level

type GormLogger

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

GormLogger gorm loggger

func NewGormLogger

func NewGormLogger(logLevel logrus.Level) *GormLogger

NewGormLogger 获取grom logger

@param logLevel
@return *GormLogger

func (GormLogger) Error

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

Error print error messages

func (GormLogger) Info

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

Info print info

func (*GormLogger) LogMode

func (l *GormLogger) LogMode(level logger.LogLevel) logger.Interface

LogMode log mode

func (GormLogger) Trace

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

Trace print sql message

func (GormLogger) Warn

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

Warn print warn messages

Jump to

Keyboard shortcuts

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