zcore

package
v2.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBodyCore

func NewBodyCore(batch logskd.LogProcessor, enab zapcore.LevelEnabler, opts ...Option) zapcore.Core

NewBodyCore creates a Core that writes logs to a WriteSyncer.

func NewCore

NewCore creates a Core that writes logs to a WriteSyncer.

func NewSampler added in v2.3.4

func NewSampler(
	core zapcore.Core,
	tick time.Duration,
	threshold, thereafter int,
	options ...SamplerOption,
) zapcore.Core

NewSampler creates a Core that samples incoming entries, which caps the CPU and I/O load of logging while attempting to preserve a representative subset of your logs.

Zap samples by logging the first N entries with a given level and message each tick. If more Entries with the same level and message are seen during the same interval, every Mth message is logged and the rest are dropped.

Sampler can be configured to report sampling decisions with the SamplerHook option.

Keep in mind that zap's sampling implementation is optimized for speed over absolute precision; under load, each tick may be slightly over- or under-sampled.

Types

type Option added in v2.3.0

type Option interface {
	// contains filtered or unexported methods
}

func WithMaxMessageSize added in v2.3.0

func WithMaxMessageSize(size int) Option

func WithSyncInterval added in v2.3.0

func WithSyncInterval(interval time.Duration) Option

type SamplerOption added in v2.3.4

type SamplerOption func(*sampler)

func WithSamplerLevelThreshold added in v2.3.4

func WithSamplerLevelThreshold(level zapcore.Level, n uint64) SamplerOption

func WithSamplerLevelThresholdString added in v2.3.4

func WithSamplerLevelThresholdString(str string) SamplerOption

Jump to

Keyboard shortcuts

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