chlog

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dev

func Dev(config Config)

Dev console DebugLevel WarnLevelAddStacktrace

Types

type CHLogger

type CHLogger struct {
	*zap.Logger
	// contains filtered or unexported fields
}

func Product

func Product(config Config) *CHLogger

Product return Config{ Level: NewAtomicLevelAt(InfoLevel), Development: false, Sampling: &SamplingConfig{ Initial: 100, Thereafter: 100, }, Encoding: "json", EncoderConfig: NewProductionEncoderConfig(), OutputPaths: []string{"stderr"}, ErrorOutputPaths: []string{"stderr"}, } Product json InfoLevel ErrorLevelStacktrace

func (*CHLogger) Close

func (logger *CHLogger) Close() error

Close 请在sync之后调用

func (*CHLogger) Sync

func (logger *CHLogger) Sync() error

type Config

type Config struct {
	Name              string                 `json:"name"`
	Roll              bool                   `json:"roll"`           //product
	RollConfig        RollConfig             `json:"rollConfig"`     //product
	LogFiles          []string               `json:"logFiles"`       //product
	InnerFiles        []string               `json:"innerFiles"`     //product
	Sampler           bool                   `json:"sampler"`        //product
	SamplingConfig    SamplingConfig         `json:"samplingConfig"` //product
	InitialFields     map[string]interface{} `json:"initialFields"`
	DisableCaller     bool                   `json:"disableCaller"`
	DisableStacktrace bool                   `json:"disableStacktrace"`
}

type RollConfig

type RollConfig struct {
	File       string `json:"file"`
	MaxSize    int    `json:"maxSize"`
	MaxBackups int    `json:"maxBackups"`
	MaxAge     int    `json:"maxAge"`
	Compress   bool   `json:"compress"`
}

type SamplingConfig

type SamplingConfig struct {
	Tick       time.Duration `json:"tick"`
	Initial    int           `json:"initial"`
	Thereafter int           `json:"thereafter"`
}

Jump to

Keyboard shortcuts

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