xlog

package
v0.0.17 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 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 Crit added in v0.0.16

func Crit(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func Debug added in v0.0.16

func Debug(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func Error added in v0.0.16

func Error(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func Info added in v0.0.16

func Info(msg string, err error)

记录详情日志

msg	消息备注
err	错误详情

func Notice added in v0.0.16

func Notice(msg string)

记录详情日志

msg	消息备注

func Panic added in v0.0.16

func Panic(msg string, err 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) 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	错误详情

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)" json:"type" form:"type"`                                     //错误类型,如:I、D等
	File      string `gorm:"column:file;type:VARCHAR(200)" json:"file" form:"file"`                                //错误文件
	Line      uint   `gorm:"column:line;type:INT UNSIGNED" json:"line" form:"line"`                                //错误行数
	Msg       string `gorm:"column:msg;type:VARCHAR(200)" json:"msg" form:"msg"`                                   //错误消息概述
	Content   string `gorm:"column:content;type:TEXT" json:"content" form:"content"`                               //错误信息内容
	CreatedAt string `gorm:"column:created_at;type:DATETIME" 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