log

package
v0.0.0-...-df633b8 Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DebugLevel = zapcore.DebugLevel
	InfoLevel  = zapcore.InfoLevel
	WarnLevel  = zapcore.WarnLevel
	ErrorLevel = zapcore.ErrorLevel
	PanicLevel = zapcore.PanicLevel
	FatalLevel = zapcore.FatalLevel
)

Functions

func CoreLogger

func CoreLogger() *zap.Logger

func Debug

func Debug(msg string, fields ...Field)

func Debugf

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

func Error

func Error(msg string, fields ...Field)

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(msg string, fields ...Field)

func Infof

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

func IsDebug

func IsDebug() bool

func Panic

func Panic(args ...interface{})

func Panicf

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

func SetDebug

func SetDebug()

func SetLevel

func SetLevel(lvl zapcore.Level)

func Sync

func Sync()

func Warn

func Warn(msg string, fields ...Field)

func Warnf

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

Types

type Config

type Config struct {
	Level string

	// Encoding sets the logger's encoding. Valid values are "json" and
	// "console", as well as any third-party encodings registered via
	// RegisterEncoder.
	Encoding string

	// DisableCaller configures the Logger to annotate each message with the filename
	// and line number of zap's caller, or not
	DisableCaller bool

	// OutputPaths is a list of URLs or file paths to write logging output to.
	// See Open for details.
	OutputPaths []string

	// ErrorOutputPaths is a list of URLs to write internal logger errors to.
	// The default is standard error.
	//
	// Note that this setting only affects internal errors; for sample code that
	// sends error-level logs to a different location from info- and debug-level
	// logs, see the package-level AdvancedConfiguration example.
	ErrorOutputPaths []string
}

type Field

type Field = zap.Field

Field is an alias of zap.Field. Aliasing this type dramatically improves the navigability of this package's API documentation.

type Level

type Level = zapcore.Level

type Logger

type Logger interface {
	Named(s string) Logger
	With(fields ...Field) Logger

	Debug(msg string, fields ...Field)
	Info(msg string, fields ...Field)
	Warn(msg string, fields ...Field)
	Error(msg string, fields ...Field)

	Clone() Logger
	Level() string
	IsDebug() bool
	Sync()

	SugaredLogger() SugaredLogger
	CoreLogger() *zap.Logger
}

Logger defines methods of writing log

func DefaultLogger

func DefaultLogger() Logger

func Named

func Named(s string) Logger

func New

func New(cfgs ...*Config) (Logger, zap.AtomicLevel)

func With

func With(fields ...Field) Logger

type SugaredLogger

type SugaredLogger interface {
	Named(name string) SugaredLogger
	With(args ...interface{}) SugaredLogger

	Debug(args ...interface{})
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Panic(args ...interface{})
	Fatal(args ...interface{})

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

	Sync()
}

func DefaultSugaredLogger

func DefaultSugaredLogger() SugaredLogger

func GetSugaredLogger

func GetSugaredLogger() SugaredLogger

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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