Documentation
¶
Index ¶
- type Option
- type StdoutOutput
- func (o *StdoutOutput) Stop(ctx context.Context) error
- func (o *StdoutOutput) SupportedTelemetry() []telemetry.Type
- func (o *StdoutOutput) Write(_ context.Context, data output.LogRecord) error
- func (o *StdoutOutput) WriteMetric(_ context.Context, data output.MetricRecord) error
- func (o *StdoutOutput) WriteTrace(_ context.Context, data output.TraceRecord) error
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
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) 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.