log

package
v0.0.0-...-21114aa Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func NewLog

func NewLog(conf *Config) *zap.Logger

NewLog initializes the LogConfig and returns a sugared LogConfig.

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func WithContext

func WithContext(ctx context.Context) *zap.SugaredLogger

Types

type Config

type Config struct {
	Output     string `toml:"output"`     // "stdout", "file", "kafka" ...
	Level      string `toml:"level"`      // "DEBUG", "INFO", "WARNING", ...
	Path       string `toml:"path"`       // 日志写入目录或文件
	KeepHours  int    `toml:"keepHours"`  // 轮转保留时长(小时)
	RotateNum  int    `toml:"rotateNum"`  // 轮转数量
	RotateSize int    `toml:"rotateSize"` // 单个文件大小上限(MB)
}

Config holds LogConfig configuration options.

type Logger

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

type Option

type Option func(*Logger)

Jump to

Keyboard shortcuts

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