stdiosink

package
v0.8.9 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDarkTheme = mustValidTheme(&typesv1.FormatConfig_Theme{
	Key:        defaultDarkLogTheme.Key,
	Value:      defaultDarkLogTheme.Value,
	Time:       defaultDarkLogTheme.Time,
	Msg:        defaultDarkLogTheme.Msg,
	AbsentMsg:  defaultDarkLogTheme.AbsentMsg,
	AbsentTime: defaultDarkLogTheme.AbsentTime,
	Levels:     defaultDarkLogTheme.Levels,

	Logs:   defaultDarkLogTheme,
	Spans:  defaultDarkSpanTheme,
	Tables: defaultDarkTableTheme,
})
View Source
var DefaultLightTheme = mustValidTheme(&typesv1.FormatConfig_Theme{
	Key:        defaultLightLogTheme.Key,
	Value:      defaultLightLogTheme.Value,
	Time:       defaultLightLogTheme.Time,
	Msg:        defaultLightLogTheme.Msg,
	AbsentMsg:  defaultLightLogTheme.AbsentMsg,
	AbsentTime: defaultLightLogTheme.AbsentTime,
	Levels:     defaultLightLogTheme.Levels,

	Logs:   defaultLightLogTheme,
	Spans:  defaultLightSpanTheme,
	Tables: defaultLightTableTheme,
})
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>",
	AbsentParentSpanContent: "<no parent>",

	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 ColorMode added in v0.8.6

type ColorMode int
const (
	Auto ColorMode = iota
	Enable
	Disable
	ForceDark
	ForceLight
)

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.Log) error

func (*Stdio) ReceiveSpan added in v0.8.5

func (std *Stdio) ReceiveSpan(ctx context.Context, span *typesv1.Span) error

func (*Stdio) ReceiveTable added in v0.8.5

func (std *Stdio) ReceiveTable(ctx context.Context, table *typesv1.Table) error

func (*Stdio) ReceiveWithPostProcess added in v0.8.0

func (std *Stdio) ReceiveWithPostProcess(ctx context.Context, ev *typesv1.Log, 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
	AbsentParentSpanContent string

	ColorMode ColorMode

	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 {
	Logs  *ThemeLog
	Spans *ThemeSpan
	Table *ThemeTable
}

func ThemeFrom added in v0.8.0

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

type ThemeLog added in v0.8.5

type ThemeLog 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 ThemeLogFrom added in v0.8.5

func ThemeLogFrom(r *lipgloss.Renderer, theme *typesv1.FormatConfig_Theme) (*ThemeLog, error)

type ThemeSpan added in v0.8.5

type ThemeSpan struct {
	TraceId            lipgloss.Style
	SpanId             lipgloss.Style
	TraceState         lipgloss.Style
	ParentSpanId       lipgloss.Style
	ParentSpanIdAbsent lipgloss.Style
	Name               lipgloss.Style
	Kind               lipgloss.Style
	ServiceName        lipgloss.Style
	ScopeName          lipgloss.Style
	ScopeVersion       lipgloss.Style
	Time               lipgloss.Style
	Duration           lipgloss.Style
	ResourceKey        lipgloss.Style
	ResourceVal        lipgloss.Style
	AttributeKey       lipgloss.Style
	AttributeVal       lipgloss.Style
	StatusMessage      lipgloss.Style
	StatusCode         lipgloss.Style

	EventTime lipgloss.Style
	EventName lipgloss.Style
	EventKey  lipgloss.Style
	EventVal  lipgloss.Style

	LinkTraceID    lipgloss.Style
	LinkSpanID     lipgloss.Style
	LinkTraceState lipgloss.Style
	LinkKey        lipgloss.Style
	LinkVal        lipgloss.Style
}

func ThemeSpanFrom added in v0.8.5

func ThemeSpanFrom(r *lipgloss.Renderer, theme *typesv1.FormatConfig_Theme) (*ThemeSpan, error)

type ThemeTable added in v0.8.5

type ThemeTable struct {
	ColumnName lipgloss.Style
	ColumnType lipgloss.Style
	Value      lipgloss.Style
}

func ThemeTableFrom added in v0.8.5

func ThemeTableFrom(r *lipgloss.Renderer, theme *typesv1.FormatConfig_Theme) (*ThemeTable, error)

Jump to

Keyboard shortcuts

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