format

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelKeys = []string{"level", "lvl", "severity"}

LevelKeys are field names that contain log level information.

View Source
var TimestampKeys = []string{"timestamp", "time", "ts", "t"}

TimestampKeys are field names that contain timestamp information.

Functions

func Entry

func Entry(e log.Entry, humanize, raw bool, highlights map[string]lipgloss.Color) string

Entry formats a log entry for display. If humanize is true, timestamps and IDs are formatted for readability. If raw is true, the original raw line is returned. Highlights is an optional map of field names to background colors.

func JSON

func JSON(fields map[string]any, humanize bool, highlights map[string]lipgloss.Color) string

JSON formats a map of fields as a styled string.

func Line

func Line(line string, format log.Format) string

Line parses and formats a raw log line. Used for plain (non-TUI) output.

func ShortenID

func ShortenID(id string) string

ShortenID creates a short 4-character hash code from an ID string. IDs with the same value will always produce the same short code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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