gologger

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: Apache-2.0, BSD-3-Clause, MIT, + 2 more Imports: 9 Imported by: 0

Documentation

Overview

Package gologger error包装器

Package gologger logger

Index

Constants

View Source
const (
	DebugLevel = logrus.DebugLevel
	ErrorLevel = logrus.ErrorLevel
	WarnLevel  = logrus.WarnLevel
	InfoLevel  = logrus.InfoLevel
)

Variables

View Source
var Logger *logrus.Logger

Functions

func Debug

func Debug(args ...interface{})

Debug logs a message at level Debug on the standard Logger 在标准Logger上记录Debug级别的消息

func Debugf

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

Debugf logs a formatted message at level Debug on the standard Logger 在标准Logger上记录格式化的Debug级别消息

func Debugln

func Debugln(args ...interface{})

Debugln logs a message at level Debug on the standard Logger 在标准Logger上记录Debug级别的消息

func Error

func Error(args ...interface{})

Error logs a message at level Error on the standard Logger 在标准Logger上记录Error级别的消息

func Errorf

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

Errorf logs a formatted message at level Error on the standard Logger 在标准Logger上记录格式化的Error级别消息

func Errorln

func Errorln(args ...interface{})

Errorln logs a message at level Error on the standard Logger 在标准Logger上记录Error级别的消息

func Fatal

func Fatal(args ...interface{})

Fatal logs a message at level Fatal on the standard Logger 在标准Logger上记录Fatal级别的消息

func Fatalf

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

Fatalf logs a formatted message at level Fatal on the standard Logger 在标准Logger上记录格式化的Fatal级别消息

func Fatalln

func Fatalln(args ...interface{})

Fatalln logs a message at level Fatal on the standard Logger 在标准Logger上记录Fatal级别的消息

func Info

func Info(args ...interface{})

Info logs a message at level Info on the standard Logger 在标准Logger上记录Info级别的消息

func Infof

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

Infof logs a formatted message at level Info on the standard Logger 在标准Logger上记录格式化的Info级别消息

func Infoln

func Infoln(args ...interface{})

Infoln logs a message at level Info on the standard Logger 在标准Logger上记录Info级别的消息

func Panic

func Panic(args ...interface{})

Panic logs a message at level Panic on the standard Logger 在标准Logger上记录Panic级别的消息

func Panicf

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

Panicf logs a formatted message at level Panic on the standard Logger 在标准Logger上记录格式化的Panic级别消息

func Panicln

func Panicln(args ...interface{})

Panicln logs a message at level Panic on the standard Logger 在标准Logger上记录Panic级别的消息

func Print

func Print(args ...interface{})

Print logs a message at level Info on the standard Logger 在标准Logger上记录Info级别的消息

func Printf

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

Printf logs a formatted message at level Info on the standard Logger 在标准Logger上记录格式化的Info级别消息

func Println

func Println(args ...interface{})

Println logs a message at level Info on the standard Logger 在标准Logger上记录Info级别的消息

func Trace

func Trace(args ...interface{})

Trace logs a message at level Trace on the standard Logger 在标准Logger上记录Trace级别的消息

func Tracef

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

Tracef logs a formatted message at level Trace on the standard Logger 在标准Logger上记录格式化的Trace级别消息

func Traceln

func Traceln(args ...interface{})

Traceln logs a message at level Trace on the standard Logger 在标准Logger上记录Trace级别的消息

func Warn

func Warn(args ...interface{})

Warn logs a message at level Warn on the standard Logger 在标准Logger上记录Warn级别的消息

func Warnf

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

Warnf logs a formatted message at level Warn on the standard Logger 在标准Logger上记录格式化的Warn级别消息

func Warning

func Warning(args ...interface{})

Warning logs a message at level Warn on the standard Logger 在标准Logger上记录Warn级别的消息

func Warningf

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

Warningf logs a formatted message at level Warn on the standard Logger 在标准Logger上记录格式化的Warn级别消息

func Warningln

func Warningln(args ...interface{})

Warningln logs a message at level Warn on the standard Logger 在标准Logger上记录Warn级别的消息

func Warnln

func Warnln(args ...interface{})

Warnln logs a message at level Warn on the standard Logger 在标准Logger上记录Warn级别的消息

func WarpError

func WarpError(err error, message string) error

WarpError combines an existing error with an additional message 将现有的错误和新的错误信息组合成一个新的错误 Parameters:

  • err: original error object (原始错误对象)
  • message: additional error message to append (要附加的额外错误信息)

Returns:

  • error: a new error combining both messages (返回组合后的新错误)

func WithError

func WithError(err error) *logrus.Entry

WithError creates an entry from the standard Logger and adds an error to it 从标准Logger创建一个条目并添加一个错误

func WithField

func WithField(key string, value interface{}) *logrus.Entry

WithField creates an entry from the standard Logger and adds a field to it 从标准Logger创建一个条目并添加一个字段

func WithFields

func WithFields(fields logrus.Fields) *logrus.Entry

WithFields creates an entry from the standard Logger and adds multiple fields to it 从标准Logger创建一个条目并添加多个字段

func WithTime

func WithTime(t time.Time) *logrus.Entry

WithTime creates an entry from the standard Logger and overrides the time of logs generated with it 从标准Logger创建一个条目并覆盖生成日志的时间

Types

type ContextHook

type ContextHook struct {
}

ContextHook hook logger

func (ContextHook) Fire

func (hook ContextHook) Fire(entry *logrus.Entry) error

Fire sets the caller information in the log entry 在日志条目中设置调用者信息

func (ContextHook) Levels

func (hook ContextHook) Levels() []logrus.Level

Levels returns all log levels 返回所有日志级别

type LogFormatter

type LogFormatter struct{}

LogFormatter 日志格式化

func (*LogFormatter) Format

func (t *LogFormatter) Format(entry *logrus.Entry) ([]byte, error)

Format formats the log entry 格式化日志条目

Jump to

Keyboard shortcuts

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