errorlog

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(ctx context.Context, entry model.ErrorLog) error

Add 写入一条错误日志。分配 snowflake ID 并落主库(错误日志随主库备份, 与转发日志分离——转发日志可能在独立日志库且被视为可丢弃数据)。 返回错误仅用于调用方记录;写入失败不应影响主流程。

func Cleanup

func Cleanup(ctx context.Context) error

Cleanup 周期清理:超过 maxKeepCount 时删除最旧的一半(与 relay_logs 的 清理策略一致,避免大表逐行删除)。

func Clear

func Clear(ctx context.Context) error

Clear 清空全部错误日志。

func GetByID

func GetByID(ctx context.Context, id int64) (*model.ErrorLog, error)

GetByID 按 ID 获取一条错误日志。记录不存在时返回 (nil, nil)。

func List

func List(ctx context.Context, filter Filter, page, pageSize int) ([]model.ErrorLog, error)

List 分页查询错误日志,按时间倒序返回完整条目(message/stack 直接返回, 错误日志量小且排障需要完整堆栈,不做大字段剥离)。

Types

type Filter

type Filter struct {
	Source    string // backend | frontend;空 = 全部
	Level     string // panic | error | ...;空 = 全部
	StartTime *int64
	EndTime   *int64
}

Filter 错误日志查询过滤条件。

Jump to

Keyboard shortcuts

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