package module
v0.0.0-...-5247eb1 Latest Latest

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 34 Imported by: 0




This section is empty.


This section is empty.


func NewCore

func NewCore(ops ...Option) (zapcore.Core, func() error)

NewCore creates a Core that writes logs to a WriteSyncer.


type Config

type Config struct {
	FlushBufferSize           int           // 缓冲大小,默认256 * 1024B
	FlushBufferInterval       time.Duration // 缓冲时间,默认5秒
	AliAccessKeyID            string        // [aliWriter]阿里云sls AKID,必填
	AliAccessKeySecret        string        // [aliWriter]阿里云sls AKSecret,必填
	AliEndpoint               string        // [aliWriter]阿里云sls endpoint,必填
	AliProject                string        // [aliWriter]阿里云sls Project名称,必填
	AliLogstore               string        // [aliWriter]阿里云sls logstore名称,必填
	AliMaxQueueSize           int           // [aliWriter]阿里云sls单实例logs等待队列最大值,默认4096
	AliAPIBulkSize            int           // [aliWriter]阿里云sls API单次请求发送最大日志条数,最少256条,默认256条
	AliAPITimeout             time.Duration // [aliWriter]阿里云sls API接口超时,默认3秒
	AliAPIRetryCount          int           // [aliWriter]阿里云sls API接口重试次数,默认3次
	AliAPIRetryWaitTime       time.Duration // [aliWriter]阿里云sls API接口重试默认等待间隔,默认1秒
	AliAPIRetryMaxWaitTime    time.Duration // [aliWriter]阿里云sls API接口重试最大等待间隔,默认3秒
	AliAPIMaxIdleConnsPerHost int           // [aliWriter]阿里云sls 单个Host HTTP最大空闲连接数,应当大于AliApiMaxIdleConns
	AliAPIMaxIdleConns        int           // [aliWriter]阿里云sls HTTP最大空闲连接数
	AliAPIIdleConnTimeout     time.Duration // [aliWriter]阿里云sls HTTP空闲连接保活时间

Config ...

type Option

type Option func(c *config)

Option 可选项

func WithAPIBulkSize

func WithAPIBulkSize(apiBulkSize int) Option

WithAPIBulkSize ...

func WithAPIIdleConnTimeout

func WithAPIIdleConnTimeout(apiIdleConnTimeout time.Duration) Option

WithAPIIdleConnTimeout ...

func WithAPIMaxIdleConns

func WithAPIMaxIdleConns(apiMaxIdleConns int) Option

WithAPIMaxIdleConns ...

func WithAPIMaxIdleConnsPerHost

func WithAPIMaxIdleConnsPerHost(apiMaxIdleConnsPerHost int) Option

WithAPIMaxIdleConnsPerHost ...

func WithAPIRetryCount

func WithAPIRetryCount(apiRetryCount int) Option

WithAPIRetryCount ...

func WithAPIRetryMaxWaitTime

func WithAPIRetryMaxWaitTime(apiRetryMaxWaitTime time.Duration) Option

WithAPIRetryMaxWaitTime ...

func WithAPIRetryWaitTime

func WithAPIRetryWaitTime(apiRetryWaitTime time.Duration) Option

WithAPIRetryWaitTime ...

func WithAPITimeout

func WithAPITimeout(apiTimeout time.Duration) Option

WithAPITimeout ...

func WithAccessKeyID

func WithAccessKeyID(akID string) Option

WithAccessKeyID ...

func WithAccessKeySecret

func WithAccessKeySecret(akSecret string) Option

WithAccessKeySecret ....

func WithEncoder

func WithEncoder(enc zapcore.Encoder) Option

WithEncoder ...

func WithEndpoint

func WithEndpoint(endpoint string) Option

WithEndpoint ...

func WithFallbackCore

func WithFallbackCore(core zapcore.Core) Option

WithFallbackCore ...

func WithFlushBufferInterval

func WithFlushBufferInterval(flushBufferInterval time.Duration) Option

WithFlushBufferInterval ...

func WithFlushBufferSize

func WithFlushBufferSize(flushBufferSize int) Option

WithFlushBufferSize ...

func WithLevelEnabler

func WithLevelEnabler(lv zapcore.LevelEnabler) Option

WithLevelEnabler ...

func WithLogstore

func WithLogstore(logStore string) Option

WithLogstore ...

func WithMaxQueueSize

func WithMaxQueueSize(maxQueueSize int) Option

WithMaxQueueSize ...

func WithProject

func WithProject(project string) Option

WithProject ...


Path Synopsis

Jump to

Keyboard shortcuts

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