log

package
v0.0.0-...-2ba7f8e Latest Latest
Warning

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

Go to latest
Published: May 31, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

View Source
const (
	// DebugLevel logs are typically voluminous, and are usually disabled in
	// production.
	DebugLevel = zap.DebugLevel
	// InfoLevel is the default logging priority.
	InfoLevel = zap.InfoLevel
	// WarningLevel logs are more important than Info, but don't need individual
	// human review.
	WarningLevel = zap.WarnLevel
	// ErrorLevel logs are high-priority. If an application is running smoothly,
	// it shouldn't generate any error-level logs.
	ErrorLevel = zap.ErrorLevel
	// FatalLevel logs a message, then calls os.Exit(1).
	FatalLevel = zap.FatalLevel
)

Variables

This section is empty.

Functions

func Debug

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

Debug print debug log

func Debugw

func Debugw(msg string, keysAndValues ...interface{})

Debugw print debug log

func Error

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

Error print error log

func Errorw

func Errorw(msg string, keysAndValues ...interface{})

Errorw print error log

func Fatal

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

Fatal print fatal log

func Fatalw

func Fatalw(msg string, keysAndValues ...interface{})

Fatalw print fatal log

func Info

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

Info print info log

func Infow

func Infow(msg string, keysAndValues ...interface{})

Infow print info log

func Init

func Init(opts ...Option) error

Init create and init a zap SugarLogger

func Sync

func Sync()

Sync sync all log to disk

func Warning

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

Warning print warning log

func Warningw

func Warningw(msg string, keysAndValues ...interface{})

Warningw print warning log

func ZapLogger

func ZapLogger() *zap.Logger

func ZapSuger

func ZapSuger() *zap.SugaredLogger

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures how we set up the zap logger.

func WithCompress

func WithCompress(compress bool) Option

WithCompress determines if compress rolled file

func WithConsole

func WithConsole(console bool) Option

WithConsole determines weather output to console

func WithLogLevel

func WithLogLevel(level zapcore.Level) Option

WithLogLevel determines which level to log

func WithLogName

func WithLogName(name string) Option

WithLogName determines which name to create log files

func WithLogPath

func WithLogPath(path string) Option

WithLogPath determines which path to create log files

func WithMaxLogSize

func WithMaxLogSize(size uint32) Option

WithMaxLogSize determines max file size of a log file

func WithOnlyConsole

func WithOnlyConsole(console bool) Option

WithOnlyConsole determines weather output to console

Jump to

Keyboard shortcuts

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