logger

package
v0.0.0-...-9fc3f77 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

func Debugf

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

func Default

func Default()

Default function initialize a default instance

func Error

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

func Errorf

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

func Fatal

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

func Fatalf

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

func Info

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

func Infof

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

func Sync

func Sync() error

Types

type Field

type Field = zapcore.Field

type Level

type Level = zapcore.Level
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in production.
	DebugLevel Level = zapcore.DebugLevel
	// InfoLevel is the default logging priority.
	InfoLevel Level = zapcore.InfoLevel
	// WarnLevel logs are more important than Info, but don't need individual human review.
	WarnLevel Level = zapcore.WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly, it shouldn't generate any error-level logs.
	ErrorLevel Level = zapcore.ErrorLevel
	// DPanicLevel logs are particularly important errors. In development the logger panics after writing the message.
	DPanicLevel Level = zapcore.DPanicLevel
	// PanicLevel logs a message, then panics.
	PanicLevel Level = zapcore.PanicLevel
	// FatalLevel logs a message, then calls os.Exit(1)
	FatalLevel Level = zapcore.FatalLevel
)

func ParseLevel

func ParseLevel(text string) Level

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func GetLogger

func GetLogger() *Logger

GetLogger obtain the global logger

func New

func New(filename string, level Level, opts ...Option) *Logger

func (*Logger) DPanic

func (lg *Logger) DPanic(msg string, fields ...Field)

func (*Logger) DPanicf

func (lg *Logger) DPanicf(template string, args ...interface{})

func (*Logger) Debug

func (lg *Logger) Debug(msg string, fields ...Field)

func (*Logger) Debugf

func (lg *Logger) Debugf(template string, args ...interface{})

func (*Logger) Error

func (lg *Logger) Error(msg string, fields ...Field)

func (*Logger) Errorf

func (lg *Logger) Errorf(template string, args ...interface{})

func (*Logger) Fatal

func (lg *Logger) Fatal(msg string, fields ...Field)

func (*Logger) Fatalf

func (lg *Logger) Fatalf(template string, args ...interface{})

func (*Logger) Info

func (lg *Logger) Info(msg string, fields ...Field)

func (*Logger) Infof

func (lg *Logger) Infof(template string, args ...interface{})

func (*Logger) Panic

func (lg *Logger) Panic(msg string, fields ...Field)

func (*Logger) Panicf

func (lg *Logger) Panicf(template string, args ...interface{})

func (*Logger) Sync

func (lg *Logger) Sync() error

type Option

type Option = zap.Option

Jump to

Keyboard shortcuts

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