gorm

package
v8.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

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

Grom Logger Hook

func New

func New(db *gorm.DB) *Hook

Create logger hook from gorm

func (*Hook) Close

func (h *Hook) Close() error

func (*Hook) Exec

func (h *Hook) Exec(entry *logrus.Entry) error

type Logger

type Logger struct {
	ID        uint      `gorm:"primaryKey;"`     // id
	Level     string    `gorm:"size:20;index;"`  // 日志级别
	TraceID   string    `gorm:"size:128;index;"` // 跟踪ID
	UserID    uint64    `gorm:"index;"`          // 用户ID
	UserName  string    `gorm:"size:64;index;"`  // 用户名
	Tag       string    `gorm:"size:128;index;"` // Tag
	Message   string    `gorm:"size:1024;"`      // 消息
	Data      string    `gorm:"type:text;"`      // 日志数据(json)
	CreatedAt time.Time `gorm:"index"`           // 创建时间
}

Jump to

Keyboard shortcuts

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