applog

package
v1.12.6 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatForFile

func FormatForFile(sources []config.FrameworkLogSource, filename string) string

FormatForFile returns the log format string for the given filename based on the framework's log sources. Falls back to "raw".

func LatestModTime

func LatestModTime(projectDir string, sources []config.FrameworkLogSource) time.Time

LatestModTime returns the most recent modification time across all log files matched by the given sources. Returns zero time if no files found.

func ResolveLogFilePath

func ResolveLogFilePath(projectDir string, sources []config.FrameworkLogSource, filename string) string

ResolveLogFilePath finds the full path for a log file by name within the configured sources. Returns empty string if not found or path traversal detected.

Types

type LogEntry

type LogEntry struct {
	Level   string `json:"level"`
	Date    string `json:"date"`
	Channel string `json:"channel"`
	Message string `json:"message"`
	Detail  string `json:"detail,omitempty"`
}

LogEntry represents a single parsed log entry.

func ParseFile

func ParseFile(path, format string, maxEntries int) ([]LogEntry, error)

ParseFile reads the tail of a log file and parses up to maxEntries entries. When maxEntries is 0, the entire file is read and all entries are returned. Returns entries in reverse-chronological order (newest first).

type LogFile

type LogFile struct {
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	ModTime string `json:"mod_time"`
}

LogFile represents an available log file on disk.

func DiscoverLogFiles

func DiscoverLogFiles(projectDir string, sources []config.FrameworkLogSource) ([]LogFile, error)

DiscoverLogFiles expands the configured log source globs for a project and returns the matching files sorted by modification time (newest first). Resolved paths are validated to stay within projectDir.

Jump to

Keyboard shortcuts

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