ginlog

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TraceIDKey     = "trace_id"
	UserIDKey      = "user_id"
	VersionKey     = "version"
	ServiceNameKey = "service_name"
)

定义键名

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

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

func Error

func Error(args ...interface{})

func Errorf

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

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func GinLogger

func GinLogger() gin.HandlerFunc

func Info

func Info(args ...interface{})

func Infof

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

func SetDebug

func SetDebug(d bool)

debug: 使用text格式, Level是Debug, 打印所有级别 not debug: 使用json格式, level是Info, 不打印Debug级别

func Warn

func Warn(args ...interface{})

func Warnf

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

func WithField

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

func WithFields

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

Types

type InterfaceTransferLog added in v1.4.1

type InterfaceTransferLog struct {
	Status    int    `gorm:"column:status;type:int(3);not null;comment:'http状态码'" json:"status"`           // http状态码
	Method    string `gorm:"column:method;type:varchar(32);not null;comment:'http方法'" json:"method"`       // http方法
	Path      string `gorm:"column:path;type:varchar(255);not null;comment:'路径'" json:"path"`              // 路径
	Query     string `gorm:"column:query;type:varchar(255);not null;comment:'参数'" json:"query"`            // 参数
	IP        string `gorm:"column:ip;type:varchar(32);not null;comment:'用户IP'" json:"ip"`                 // 用户IP
	UserAgent string `gorm:"column:user_agent;type:varchar(255);not null;comment:'客户端'" json:"user_agent"` // 客户端
	Errors    string `gorm:"column:errors;type:text;not null;comment:'错误信息'" json:"errors"`                // 错误信息
	Latency   int    `gorm:"column:latency;type:int(32);not null;comment:'延迟(单位:毫秒)'" json:"latency"`      // 延迟(单位:毫秒)
	UserID    int64  `gorm:"column:user_id;type:bigint(10);not null;comment:'用户id'" json:"user_id"`        // 用户id
	RealName  string `gorm:"column:real_name;type:varchar(64);not null;comment:'真实姓名'" json:"real_name"`   // 真实姓名
	Username  string `gorm:"column:username;type:varchar(32);not null;comment:'用户名'" json:"username"`      // 用户名
	Param     string `gorm:"column:param;type:text;default:null;comment:'请求body信息'" json:"param"`          // 请求body信息
	ResBody   string `gorm:"column:res_body;type:text;default:null;comment:'请求body信息'" json:"res_body"`    // 请求body信息
	LogType   string `json:"log_type"`                                                                     // 日志类型
}

type MicroLoggerI

type MicroLoggerI struct{}

func NewMicroLogger

func NewMicroLogger() *MicroLoggerI

func (*MicroLoggerI) Log

func (o *MicroLoggerI) Log(v ...interface{})

func (*MicroLoggerI) Logf

func (o *MicroLoggerI) Logf(format string, v ...interface{})

Logf logs formatted using the default logger

type NsqLoggerI

type NsqLoggerI struct{}

func NsqLogger

func NsqLogger() *NsqLoggerI

func (*NsqLoggerI) Output

func (l *NsqLoggerI) Output(calldepth int, s string) error

type OrmLoggerI

type OrmLoggerI struct {
}

func NewGormLogger

func NewGormLogger() *OrmLoggerI

func (*OrmLoggerI) Print

func (o *OrmLoggerI) Print(v ...interface{})

Jump to

Keyboard shortcuts

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