stdiosink

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDarkTheme = mustValidTheme(&typesv1.FormatConfig_Theme{
	Key:   fgstyle("#48df61"),
	Value: fgstyle("#8c887c"),
	Time:  fgstyle("#9e9e9e"),
	Msg:   fgstyle("#ffffff"),
	Levels: &typesv1.FormatConfig_LevelStyle{
		Debug:   fgstyle("#d33682"),
		Info:    fgstyle("#2aa198"),
		Warn:    fgstyle("#ff8800"),
		Error:   fgstyle("#ff6a6a"),
		Panic:   fgbdstyle("#ff6a6a", "#ffffff"),
		Fatal:   fgbdstyle("#ff6a6a", "#ffff00"),
		Unknown: fgstyle("#a9a9a9"),
	},
	AbsentMsg:  fgstyle("#a9a9a9"),
	AbsentTime: fgstyle("#a9a9a9"),
})
View Source
var DefaultLightTheme = mustValidTheme(&typesv1.FormatConfig_Theme{
	Key:   fgstyle("#146e23"),
	Value: fgstyle("#878376"),
	Time:  fgstyle("#565454"),
	Msg:   fgstyle("#000000"),
	Levels: &typesv1.FormatConfig_LevelStyle{
		Debug:   fgstyle("#d33682"),
		Info:    fgstyle("#2aa198"),
		Warn:    fgstyle("#ff8800"),
		Error:   fgstyle("#d82626"),
		Panic:   fgbdstyle("#d82626", "#ffffff"),
		Fatal:   fgbdstyle("#d82626", "#ffff00"),
		Unknown: fgstyle("#a9a9a9"),
	},
	AbsentMsg:  fgstyle("#a9a9a9"),
	AbsentTime: fgstyle("#a9a9a9"),
})
View Source
var DefaultStdioOpts = StdioOpts{

	SkipUnchanged:     true,
	SortLongest:       true,
	TimeFormat:        time.Stamp,
	TimeZone:          time.Local,
	TruncateLength:    15,
	Truncates:         false,
	AbsentMsgContent:  "<no msg>",
	AbsentTimeContent: "<no time>",

	LightTheme: func(r *lipgloss.Renderer) (*Theme, error) { return ThemeFrom(r, DefaultLightTheme) },
	DarkTheme:  func(r *lipgloss.Renderer) (*Theme, error) { return ThemeFrom(r, DefaultDarkTheme) },
}

Functions

func ValidateTheme added in v0.8.0

func ValidateTheme(v *typesv1.FormatConfig_Theme) error

Types

type Stdio

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

func NewStdio

func NewStdio(w io.Writer, opts StdioOpts) (*Stdio, error)

func (*Stdio) Close added in v0.8.0

func (std *Stdio) Close(ctx context.Context) error

func (*Stdio) Receive

func (std *Stdio) Receive(ctx context.Context, ev *typesv1.LogEvent) error

func (*Stdio) ReceiveWithPostProcess added in v0.8.0

func (std *Stdio) ReceiveWithPostProcess(ctx context.Context, ev *typesv1.LogEvent, postProcess func(string) string) error

type StdioOpts

type StdioOpts struct {
	Keep              []string
	Skip              []string
	SkipUnchanged     bool
	SortLongest       bool
	TimeFormat        string
	TimeZone          *time.Location
	TruncateLength    int
	Truncates         bool
	AbsentMsgContent  string
	AbsentTimeContent string

	LightTheme func(r *lipgloss.Renderer) (*Theme, error)
	DarkTheme  func(r *lipgloss.Renderer) (*Theme, error)
}

func StdioOptsFrom

func StdioOptsFrom(cfg *typesv1.FormatConfig) (StdioOpts, []error)

type Theme added in v0.8.0

type Theme struct {
	Key          lipgloss.Style
	Val          lipgloss.Style
	Time         lipgloss.Style
	TimeAbsent   lipgloss.Style
	Msg          lipgloss.Style
	MsgAbsent    lipgloss.Style
	DebugLevel   lipgloss.Style
	InfoLevel    lipgloss.Style
	WarnLevel    lipgloss.Style
	ErrorLevel   lipgloss.Style
	PanicLevel   lipgloss.Style
	FatalLevel   lipgloss.Style
	UnknownLevel lipgloss.Style
}

func ThemeFrom added in v0.8.0

func ThemeFrom(r *lipgloss.Renderer, theme *typesv1.FormatConfig_Theme) (*Theme, error)

Jump to

Keyboard shortcuts

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