chlog

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CHLogger

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

func Dev

func Dev(config Config) *CHLogger

Dev console DebugLevel WarnLevelAddStacktrace

func New added in v1.2.0

func New(config Config) *CHLogger

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 {
	Dev               bool                   `json:"dev" yaml:"dev" mapstructure:"dev"`
	Name              string                 `json:"name" yaml:"name" mapstructure:"name"`
	Roll              bool                   `json:"roll" roll:"tick" mapstructure:"roll"`                               //product
	RollConfig        RollConfig             `json:"rollConfig" yaml:"rollConfig" mapstructure:"rollConfig"`             //product
	LogFiles          []string               `json:"logFiles" yaml:"logFiles" mapstructure:"logFiles"`                   //product
	InnerFiles        []string               `json:"innerFiles" yaml:"innerFiles" mapstructure:"innerFiles"`             //product
	Sampler           bool                   `json:"sampler" yaml:"sampler" mapstructure:"sampler"`                      //product
	SamplingConfig    SamplingConfig         `json:"samplingConfig" yaml:"samplingConfig" mapstructure:"samplingConfig"` //product
	InitialFields     map[string]interface{} `json:"initialFields" yaml:"initialFields" mapstructure:"initialFields"`
	DisableCaller     bool                   `json:"disableCaller" yaml:"disableCaller" mapstructure:"disableCaller"`
	DisableStacktrace bool                   `json:"disableStacktrace" yaml:"disableStacktrace" mapstructure:"disableStacktrace"`
}

type RollConfig

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

type SamplingConfig

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

Jump to

Keyboard shortcuts

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