xlog

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 License: BSD-3-Clause-Clear Imports: 5 Imported by: 0

Documentation

Overview

日志记录模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert added in v0.0.16

func Alert(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func AlertError added in v0.1.1

func AlertError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Crit added in v0.0.16

func Crit(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func CritError added in v0.1.1

func CritError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Debug added in v0.0.16

func Debug(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func DebugError added in v0.1.1

func DebugError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Error added in v0.0.16

func Error(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func ErrorError added in v0.1.1

func ErrorError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Info added in v0.0.16

func Info(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func InfoError added in v0.1.1

func InfoError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Notice added in v0.0.16

func Notice(msg string)

记录详情日志

msg	消息备注

func NoticeError added in v0.1.1

func NoticeError(msg string) error

记录详情日志,返回error类型,以便其他方法调用

func Panic added in v0.0.16

func Panic(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func PanicError added in v0.1.1

func PanicError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

func Regedit

func Regedit(c *Config)

注入配置项

func SaveAny added in v0.0.17

func SaveAny(inf byte, file string, line uint, msg string, err error)

记录日志信息[对外函数,用于记录任意类型/等级的日志信息]

inf		日志等级
file	错误文件
line	错误行号
msg		消息备注
err		错误详情

func SaveAnyError added in v0.1.1

func SaveAnyError(inf byte, file string, line uint, msg string, err error) error

记录日志信息[对外函数,用于记录任意类型/等级的日志信息]

inf		日志等级
file	错误文件
line	错误行号
msg		消息备注
err		错误详情

func User added in v0.0.16

func User(uid uint, typ, info string)

记录用户日志

uid		用户ID
typ		记录类型
info	记录的详细信息

func Warning added in v0.0.16

func Warning(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func WarningError added in v0.1.1

func WarningError(msg string, err error) error

记录详情日志

msg	消息备注
err	错误详情

Types

type Config

type Config struct {
	DB        *gorm.DB // 数据库连接
	TableName string   // 日志记录的数据表
	RunDir    string   // 程序所在目录
}

配置项

type LogStruct added in v0.0.16

type LogStruct struct {
	Id        uint64 `gorm:"column:id;primaryKey;type:BIGINT UNSIGNED;not null;autoIncrement" json:"id" form:"id"` // 条目ID
	Type      string `gorm:"column:type;type:CHAR(1);comment:错误类型;index:error_type" json:"type" form:"type"`       //错误类型,如:I、D等
	File      string `gorm:"column:file;type:VARCHAR(200);comment:错误文件" json:"file" form:"file"`                   //错误文件
	Line      uint   `gorm:"column:line;type:INT UNSIGNED;comment:文件行数" json:"line" form:"line"`                   //错误行数
	Msg       string `gorm:"column:msg;type:VARCHAR(200);comment:消息概述" json:"msg" form:"msg"`                      //错误消息概述
	Content   string `gorm:"column:content;type:TEXT;comment:错误消息内容" json:"content" form:"content"`                //错误信息内容
	CreatedAt string `gorm:"column:created_at;type:DATETIME;comment:创建时间" json:"created_at" form:"created_at"`     //错误发生时间
}

错误信息统计表

func (*LogStruct) TableName added in v0.0.16

func (c *LogStruct) TableName() string

获取表名

Jump to

Keyboard shortcuts

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