zap

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

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

Go to latest
Published: Dec 29, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelDebug = "debug"
	LevelInfo  = "info"
	LevelWarn  = "warn"
	LevelError = "error"
)

Variables

This section is empty.

Functions

func Debug

func Debug(ctx context.Context, msg, category string)

func Error

func Error(ctx context.Context, msg, category string)

func Fatal

func Fatal(ctx context.Context, msg, category string)

func Info

func Info(ctx context.Context, msg, category string)

func Logger

func Logger() *zap.Logger

func Setup

func Setup(opts ...Option)

func Warn

func Warn(ctx context.Context, msg, category string)

Types

type Config

type Config struct {
	Zap Options `json:"zap"`
}

func (Config) Close

func (c Config) Close() error

func (Config) Init

func (c Config) Init() error

type Option

type Option func(*Options)

func FileCompress

func FileCompress(compress bool) Option

func FileMaxAge

func FileMaxAge(days int) Option

func FileMaxBackups

func FileMaxBackups(num int) Option

func FileMaxSize

func FileMaxSize(size int) Option

func LogLevel

func LogLevel(level string) Option

func LogPath

func LogPath(path string) Option

type Options

type Options struct {
	LogPath        string `json:"log_path" mapstructure:"log_path"`
	FileMaxSize    int    `json:"file_max_size" mapstructure:"file_max_size" `
	FileMaxBackups int    `json:"file_max_backups" mapstructure:"file_max_backups"`
	FileMaxAge     int    `json:"file_max_age" mapstructure:"file_max_age"`
	FileCompress   bool   `json:"file_compress" mapstructure:"file_compress"`
	LogLevel       string `json:"log_level" mapstructure:"log_level"`
}

func GetConfig

func GetConfig() Options

Jump to

Keyboard shortcuts

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