logviewer

package
v1.4.67 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogEntry

type LogEntry struct {
	models.LogEvent
	Time string `json:"time"` // Shadowing Timestamp with string
}

LogEntry represents a single log entry parsed from the log file. It mirrors models.LogEvent but is defined here for the service API.

func (LogEntry) MarshalJSON added in v1.4.60

func (e LogEntry) MarshalJSON() ([]byte, error)

MarshalJSON customizes JSON marshaling to convert level integer to string

type LogFile

type LogFile struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	ModTime time.Time `json:"modTime"`
}

LogFile represents a log file in the directory.

type Service

type Service struct {
	LogDirectory string
	Format       string // "text" or "json"
}

Service provides methods for viewing log files.

func NewService

func NewService(config models.WriterConfiguration) *Service

NewService creates a new LogViewer Service.

func (*Service) GetLogContent

func (s *Service) GetLogContent(filename string, limit int, levels []string) ([]LogEntry, error)

GetLogContent returns parsed log entries from a specific log file. filename: The name of the file to read. limit: Number of lines to read from the end (tail). If <= 0, reads all. levels: List of log levels to filter by (case-insensitive). If empty, returns all.

func (*Service) ListLogFiles

func (s *Service) ListLogFiles() ([]LogFile, error)

ListLogFiles returns a list of log files in the configured directory.

Jump to

Keyboard shortcuts

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