stdout

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v0.14.0

type Option func(*config) error

Option is a functional option for configuring the stdout output.

func WithFlushInterval added in v0.14.0

func WithFlushInterval(d time.Duration) Option

WithFlushInterval sets the interval at which the internal buffer is flushed to stdout.

type StdoutOutput

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

StdoutOutput writes log records to standard output via a buffered writer. Records are batched in memory and flushed to os.Stdout periodically, reducing per-record syscall overhead under high worker counts.

func New

func New(logger *zap.Logger, opts ...Option) (*StdoutOutput, error)

New creates a new stdout output. The goroutine that drives periodic flushing starts immediately and runs until Stop is called.

func (*StdoutOutput) Stop

func (o *StdoutOutput) Stop(ctx context.Context) error

Stop signals the flush goroutine to exit and performs a best-effort flush of any buffered records. Records remaining in the buffer on a hard kill are lost.

func (*StdoutOutput) SupportedTelemetry added in v0.16.0

func (o *StdoutOutput) SupportedTelemetry() []telemetry.Type

SupportedTelemetry returns the telemetry types this output can consume.

func (*StdoutOutput) Write

func (o *StdoutOutput) Write(_ context.Context, data output.LogRecord) error

Write buffers the log record for the next flush.

func (*StdoutOutput) WriteMetric added in v0.16.0

func (o *StdoutOutput) WriteMetric(_ context.Context, data output.MetricRecord) error

WriteMetric writes a metric record to stdout as JSON.

func (*StdoutOutput) WriteTrace added in v0.16.0

func (o *StdoutOutput) WriteTrace(_ context.Context, data output.TraceRecord) error

WriteTrace writes a trace record to stdout as JSON.

Jump to

Keyboard shortcuts

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