stdout

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: Apache-2.0 Imports: 8 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) Write

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

Write buffers the log record for the next flush.

Jump to

Keyboard shortcuts

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