logs

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogManager

type LogManager interface {
	CollectLogs(ctx context.Context, serviceID string, lines int) ([]string, error)
	GetLogFile(serviceID string) (io.ReadCloser, error)
	RotateLogs(serviceID string) error
	StreamLogs(ctx context.Context, serviceID string, tailLines int, follow bool, logChan chan<- string) error
	QueryLogs(ctx context.Context, serviceID string, options LogQueryOptions) (*LogQueryResult, error)
}

LogManager 日志管理器接口

func NewLogManager

func NewLogManager(logDir string, maxSize int64, maxFiles int, logger *zap.Logger) LogManager

NewLogManager 创建日志管理器

type LogQueryOptions

type LogQueryOptions struct {
	Keyword   string     // 搜索关键词
	Level     string     // 日志级别过滤
	StartTime *time.Time // 开始时间
	EndTime   *time.Time // 结束时间
	Limit     int        // 返回的最大行数
	Offset    int        // 偏移量
	Reverse   bool       // 是否反向排序
}

LogQueryOptions 日志查询选项

type LogQueryResult

type LogQueryResult struct {
	Logs    []string // 匹配的日志行
	Total   int      // 总行数(匹配条件的)
	HasMore bool     // 是否还有更多结果
}

LogQueryResult 日志查询结果

Jump to

Keyboard shortcuts

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