Documentation
¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Fatal(args ...interface{})
- func Fatalf(format string, args ...interface{})
- func GinLogger() gin.HandlerFunc
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func SetDebug(d bool)
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func WithField(key string, value interface{}) *logrus.Entry
- func WithFields(fs logrus.Fields) *logrus.Entry
- type InterfaceTransferLog
- type MicroLoggerI
- type NsqLoggerI
- type OrmLoggerI
Constants ¶
View Source
const ( TraceIDKey = "trace_id" UserIDKey = "user_id" VersionKey = "version" ServiceNameKey = "service_name" )
定义键名
Variables ¶
This section is empty.
Functions ¶
func GinLogger ¶
func GinLogger() gin.HandlerFunc
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 OrmLoggerI ¶
type OrmLoggerI struct {
}
func NewGormLogger ¶
func NewGormLogger() *OrmLoggerI
func (*OrmLoggerI) Print ¶
func (o *OrmLoggerI) Print(v ...interface{})
Click to show internal directories.
Click to hide internal directories.