logtool

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Download

func Download(ctx *gin.Context)

func DownloadLogs

func DownloadLogs(ctx *gin.Context, path string) *errors.Error

DownloadLogs downloads logs based on categories and conditions

func FetchCategories added in v1.0.28

func FetchCategories(rootDir string) ([]string, *errors.Error)

func GetCategories

func GetCategories(ctx *gin.Context)

func GetLevels

func GetLevels(ctx *gin.Context)

func ListLogFiles

func ListLogFiles(opts SearchOptions) (map[string]string, error)

func Monitor

func Monitor(ctx *gin.Context)

func MonitorLogs

func MonitorLogs(ctx *gin.Context, opts SearchOptions) *errors.Error

MonitorLogs monitors logs based on categories and conditions in real-time

func Near

func Near(ctx *gin.Context)
func Search(ctx *gin.Context)

Types

type ContextLogLine

type ContextLogLine struct {
	FilePath   string     `json:"path"`
	LineNumber int64      `json:"line"`
	Content    string     `json:"content"`
	Record     *LogRecord `json:"record"`
}

func FetchContextLines

func FetchContextLines(filePath string, centerLine, contextRange int64) ([]ContextLogLine, *errors.Error)

type Level added in v1.0.26

type Level string
const (
	DebugLevel  Level = "debug"
	InfoLevel   Level = "info"
	WarnLevel   Level = "warn"
	ErrorLevel  Level = "error"
	FatalLevel  Level = "fatal"
	DpanicLevel Level = "dpanic"
)

func (Level) Str added in v1.0.26

func (l Level) Str() string

type LogRecord

type LogRecord struct {
	Level   string            `json:"level"`
	Time    string            `json:"time"`
	Msg     string            `json:"msg"`
	TraceID string            `json:"_trace_id_"`
	Error   string            `json:"error"`
	Data    map[string]string `json:"data"`
}

func (*LogRecord) ParsedTime

func (r *LogRecord) ParsedTime() (time.Time, error)

func (*LogRecord) ToJsonStr

func (r *LogRecord) ToJsonStr() string

func (*LogRecord) Validate

func (r *LogRecord) Validate() error

type MatchedRecord

type MatchedRecord struct {
	FilePath   string     `json:"path"`
	LineNumber int64      `json:"line"`
	Record     *LogRecord `json:"record"`
}

func SearchLogs

func SearchLogs(opts SearchOptions) ([]MatchedRecord, *errors.Error)

func (MatchedRecord) ToJsonStr

func (m MatchedRecord) ToJsonStr() string

type SearchOptions

type SearchOptions struct {
	Categories []string `json:"categories" form:"categories"`
	Level      string   `json:"level" form:"level"`
	Levels     []string `json:"levels" form:"levels"`
	TraceID    string   `json:"traceID" form:"traceID"`
	Keyword    string   `json:"keyword" form:"keyword"`
	StartTime  string   `json:"startTime" form:"startTime"`
	EndTime    string   `json:"endTime" form:"endTime"`

	RootDir  string `json:"root_dir" form:"rootDir"`
	Size     int    `json:"size" form:"size"`
	LastPath string `json:"lastPath" form:"lastPath"`
	LastLine int64  `json:"lastLine" form:"lastLine"`
}

Jump to

Keyboard shortcuts

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