logutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Adjust added in v0.5.0

func Adjust(logger *zap.Logger, options ...zap.Option) *zap.Logger

Adjust returns default logger if logger is nil

func Debug

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

func Debugf

func Debugf(msg string, fields ...interface{})

Debugf only use in develop mode

func Error

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

func Errorf

func Errorf(msg string, fields ...interface{})

Errorf only use in develop mode

func Fatal

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

func Fatalf

func Fatalf(msg string, fields ...interface{})

Fatalf only use in develop mode

func GetGlobalLogger

func GetGlobalLogger() *zap.Logger

GetGlobalLogger returns the current global zap Logger.

func GetLogger added in v0.5.0

func GetLogger(options ...zap.Option) *zap.Logger

GetLogger get default zap logger

func GetLoggerWithOptions added in v0.5.0

func GetLoggerWithOptions(level zapcore.LevelEnabler, encoder zapcore.Encoder, syncer zapcore.WriteSyncer, options ...zap.Option) *zap.Logger

GetLoggerWithOptions get default zap logger

func GetPanicLogger added in v0.5.0

func GetPanicLogger(options ...zap.Option) *zap.Logger

GetPanicLogger returns a zap logger which will panic on Fatal(). The returned zap logger should only be used in tests.

func GetPanicLoggerWithLevel added in v0.5.0

func GetPanicLoggerWithLevel(level zapcore.Level, options ...zap.Option) *zap.Logger

GetPanicLoggerWithLevel returns a zap logger which will panic on Fatal(). The returned zap logger should only be used in tests.

func Info

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

func Infof

func Infof(msg string, fields ...interface{})

Infof only use in develop mode

func Panic

func Panic(msg string, fields ...zap.Field)

func Panicf

func Panicf(msg string, fields ...interface{})

Panicf only use in develop mode

func SetupMOLogger

func SetupMOLogger(conf *LogConfig)

SetupMOLogger sets up the global logger for MO Server.

func Warn

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

func Warnf

func Warnf(msg string, fields ...interface{})

Warnf only use in develop mode

Types

type GoettyLogger

type GoettyLogger struct{}

func (*GoettyLogger) Debugf

func (l *GoettyLogger) Debugf(msg string, fields ...interface{})

func (*GoettyLogger) Errorf

func (l *GoettyLogger) Errorf(msg string, fields ...interface{})

func (*GoettyLogger) Fatalf

func (l *GoettyLogger) Fatalf(msg string, fields ...interface{})

func (*GoettyLogger) Infof

func (l *GoettyLogger) Infof(msg string, fields ...interface{})

type LogConfig added in v0.5.0

type LogConfig struct {
	Level      string `toml:"level"`
	Format     string `toml:"format"`
	Filename   string `toml:"filename"`
	MaxSize    int    `toml:"max-size"`
	MaxDays    int    `toml:"max-days"`
	MaxBackups int    `toml:"max-backups"`
}

Jump to

Keyboard shortcuts

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