zap

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ZapLogger is kept for backward compatibility with existing integrations
	// (e.g. gin middleware expecting *zap.Logger).
	ZapLogger *zap.Logger
)

Functions

func Debug

func Debug(args ...interface{})

Debug is debug level

func Debugf

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

Debugf is format debug level

func Error

func Error(args ...interface{})

Error is error level

func Errorf

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

Errorf is format error level

func Fatal

func Fatal(args ...interface{})

func Fatalf

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

func Info

func Info(args ...interface{})

Info is info level

func Infof

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

Infof is format info level

func Sync

func Sync()

func Warn

func Warn(args ...interface{})

Warn is warning level

func Warnf

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

Warnf is format warning level

Types

type Config

type Config struct {
	Level            string
	LogFileName      string
	Sampling         *SamplingConfig
	LogRollingConfig *lumberjack.Logger
	LogDir           string
	CustomLogger     Logger
	LogStdout        bool
}

type Logger

type Logger interface {
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Debug(args ...interface{})
	Fatal(args ...interface{})
	Sync() error

	Infof(fmt string, args ...interface{})
	Warnf(fmt string, args ...interface{})
	Errorf(fmt string, args ...interface{})
	Debugf(fmt string, args ...interface{})
	Fatalf(fmt string, args ...interface{})
}

Logger is the interface for Logger types

func GetLogger

func GetLogger() Logger

func InitLogger

func InitLogger(config Config) (ins Logger, err error)

InitLogger is init global logger for nacos

type NacosLogger

type NacosLogger struct {
	Logger
}

type SamplingConfig

type SamplingConfig struct {
	Initial    int
	Thereafter int
	Tick       time.Duration
}

Jump to

Keyboard shortcuts

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