logs

package
v0.25.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JSONWriter

type JSONWriter struct {
	Writer io.Writer
	Source *StreamSource
	// contains filtered or unexported fields
}

JSONWriter formats log lines as JSON objects

func NewJSONWriter

func NewJSONWriter(w io.Writer, source *StreamSource) *JSONWriter

NewJSONWriter creates a new JSON writer

func (*JSONWriter) Write

func (jw *JSONWriter) Write(p []byte) (int, error)

Write writes data as JSON formatted log entries

type LogEntry

type LogEntry struct {
	Timestamp   string `json:"timestamp" yaml:"timestamp"`
	Component   string `json:"component" yaml:"component"`
	ComponentID string `json:"componentId" yaml:"componentId"`
	Pod         string `json:"pod" yaml:"pod"`
	Container   string `json:"container" yaml:"container"`
	Namespace   string `json:"namespace" yaml:"namespace"`
	Message     string `json:"message" yaml:"message"`
}

LogEntry represents a structured log entry for JSON/YAML output

type LogStreamer

type LogStreamer struct {
	Config    *rest.Config
	PodClient v1.PodsGetter
	Namespace string
	PodName   string
	Container string
	Options   *Options
	Stream    io.ReadCloser
}

func NewLogStreamer

func NewLogStreamer(kubeConfig []byte, options *Options) (*LogStreamer, error)

NewLogStreamer creates a new log streamer for a specific pod/container

func (*LogStreamer) Close

func (ls *LogStreamer) Close() error

Close closes the log stream

func (*LogStreamer) Read

func (ls *LogStreamer) Read(p []byte) (int, error)

Read reads from the log stream

func (*LogStreamer) Start

func (ls *LogStreamer) Start(ctx context.Context) error

Start begins streaming logs from the pod/container

type Multiplexer

type Multiplexer struct {
	Sources      []*StreamSource
	Prefix       bool
	NoColor      bool
	OutputFormat string // "stylish", "json", "yaml"
	// contains filtered or unexported fields
}

Multiplexer coordinates concurrent log streaming from multiple sources

func NewMultiplexer

func NewMultiplexer(sources []*StreamSource, prefix bool, noColor bool, outputFormat string) *Multiplexer

NewMultiplexer creates a new log multiplexer

func (*Multiplexer) Start

func (m *Multiplexer) Start() error

Start begins streaming from all sources concurrently

func (*Multiplexer) Stop

func (m *Multiplexer) Stop()

Stop cancels all active streams

func (*Multiplexer) Wait

func (m *Multiplexer) Wait() []error

Wait blocks until all streams complete or are stopped

type Options

type Options struct {
	// Pod/Container selection
	Namespace string
	PodName   string
	Container string

	// Log filtering (kubectl standard)
	Follow     bool
	Tail       *int64
	Since      *time.Duration
	SinceTime  *time.Time
	Timestamps bool
	Previous   bool
}

type PrefixWriter

type PrefixWriter struct {
	Writer io.Writer
	Prefix string
	Color  *color.Color
	// contains filtered or unexported fields
}

PrefixWriter wraps an io.Writer with thread-safe line prefixing

func NewPrefixWriter

func NewPrefixWriter(w io.Writer, prefix string, c *color.Color, noColor bool) *PrefixWriter

NewPrefixWriter creates a new prefix writer

func (*PrefixWriter) Flush

func (pw *PrefixWriter) Flush() error

Flush flushes any remaining data in the buffer

func (*PrefixWriter) Write

func (pw *PrefixWriter) Write(p []byte) (int, error)

Write writes data with prefix for each line

type StreamSource

type StreamSource struct {
	ComponentID   string
	ComponentName string
	Namespace     string
	PodName       string
	Container     string
	Streamer      *LogStreamer
}

StreamSource represents a single log stream source

type YAMLWriter

type YAMLWriter struct {
	Writer io.Writer
	Source *StreamSource
	// contains filtered or unexported fields
}

YAMLWriter formats log lines as YAML documents

func NewYAMLWriter

func NewYAMLWriter(w io.Writer, source *StreamSource) *YAMLWriter

NewYAMLWriter creates a new YAML writer

func (*YAMLWriter) Write

func (yw *YAMLWriter) Write(p []byte) (int, error)

Write writes data as YAML formatted log entries

Jump to

Keyboard shortcuts

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