logfmt

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorizeText

func ColorizeText(line string) string

ColorizeText handles non-JSON log lines (plain text).

func FieldInt

func FieldInt(obj map[string]interface{}, keys ...string) int64

FieldInt extracts an int64 value from a map, trying multiple key names.

func FieldStr

func FieldStr(obj map[string]interface{}, keys ...string) string

FieldStr extracts a string value from a map, trying multiple key names.

func FormatDuration

func FormatDuration(ns int64) string

FormatDuration formats nanoseconds as a human-readable duration.

func FormatJSON

func FormatJSON(obj map[string]interface{}) string

FormatJSON renders a structured JSON log line as a clean, colorized single line.

func FormatLevel

func FormatLevel(level string) string

FormatLevel returns a colorized, left-aligned level string.

func FormatLine

func FormatLine(line string) string

FormatLine detects JSON log lines and formats them; falls back to text colorization.

func FormatStatus

func FormatStatus(code int64) string

FormatStatus returns a colorized HTTP status code.

func FormatTimestamp

func FormatTimestamp(ts string) string

FormatTimestamp converts an ISO timestamp to a friendlier format.

func FormatValue

func FormatValue(v interface{}) string

FormatValue renders a JSON value as a short string for key=value display.

func MatchLevel

func MatchLevel(line, level string) bool

MatchLevel checks if a log line contains a specific log level.

Types

This section is empty.

Jump to

Keyboard shortcuts

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