log

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractComponentFromStreamName

func ExtractComponentFromStreamName(streamName string) string

func ExtractLogLevel

func ExtractLogLevel(message string) string

func ExtractLogTypeFromStreamName

func ExtractLogTypeFromStreamName(streamName string) string

func GetLogTypeDescription

func GetLogTypeDescription(availableLogTypes []string) string

func NormalizeLogType

func NormalizeLogType(logType string) string

func ParseTimeString

func ParseTimeString(timeStr string) (*time.Time, error)

func PrintLog

func PrintLog(log LogEntry, messageOnly bool, colorConfig *ColorConfig)

Types

type ColorConfig added in v0.1.6

type ColorConfig struct {
	Mode ColorMode
}

ColorConfig holds the configuration for color output

func NewColorConfig added in v0.1.6

func NewColorConfig() *ColorConfig

NewColorConfig creates a new ColorConfig with default settings

func (*ColorConfig) ShouldUseColor added in v0.1.6

func (c *ColorConfig) ShouldUseColor() bool

ShouldUseColor determines whether colors should be used based on the configuration

type ColorMode added in v0.1.6

type ColorMode string

ColorMode defines how colors should be handled

const (
	// ColorModeAuto automatically determines whether to use colors based on terminal detection
	ColorModeAuto ColorMode = "auto"
	// ColorModeAlways forces colors to be used
	ColorModeAlways ColorMode = "always"
	// ColorModeNever disables colors
	ColorModeNever ColorMode = "never"
)

type LogColorizer added in v0.1.6

type LogColorizer struct {
	// contains filtered or unexported fields
}

LogColorizer provides rich color formatting for logs

func NewLogColorizer added in v0.1.6

func NewLogColorizer(config *ColorConfig) *LogColorizer

NewLogColorizer creates a new LogColorizer

func (*LogColorizer) ColorizeLog added in v0.1.6

func (lc *LogColorizer) ColorizeLog(entry LogEntry) string

ColorizeLog applies color formatting to a log entry based on its type and content

func (*LogColorizer) ColorizeMessageOnly added in v0.1.6

func (lc *LogColorizer) ColorizeMessageOnly(message string, logType string, level string) string

ColorizeMessageOnly applies color formatting to just the message part based on log type

type LogEntry

type LogEntry struct {
	Timestamp time.Time `json:"@timestamp"`
	Level     string    `json:"level,omitempty"`
	Component string    `json:"component"`
	Message   string    `json:"message"`
	LogGroup  string    `json:"log_group"`
	LogStream string    `json:"log_stream"`
}

Jump to

Keyboard shortcuts

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