logutil

package
v0.0.0-...-1b33b2a Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLogger

func InitLogger(cfg *Config) error

InitLogger initializes logger

func SetLogLevel

func SetLogLevel(level string) error

SetLogLevel changes TiCDC log level dynamically.

func ZapErrorFilter

func ZapErrorFilter(err error, filterErrors ...error) zap.Field

ZapErrorFilter wraps zap.Error, if err is in given filterErrors, it will be set to nil

Types

type Config

type Config struct {
	// Log level.
	Level string `toml:"level" json:"level"`
	// Log filename, leave empty to disable file log.
	File string `toml:"file" json:"file"`
	// Max size for a single file, in MB.
	FileMaxSize int `toml:"max-size" json:"max-size"`
	// Max log keep days, default is never deleting.
	FileMaxDays int `toml:"max-days" json:"max-days"`
	// Maximum number of old log files to retain.
	FileMaxBackups int `toml:"max-backups" json:"max-backups"`
	// ZapInternalErrOutput specify where the internal error of zap logger should be send to.
	ZapInternalErrOutput string `toml:"error-output" json:"error-output"`
}

Config serializes log related config in toml/json.

func (*Config) Adjust

func (cfg *Config) Adjust()

Adjust adjusts config

Jump to

Keyboard shortcuts

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