logger

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultEnv        = LogDevelopEnv
	DefaultLevel      = zapcore.DebugLevel
	DefaultCallerSkip = 1
)

Variables

This section is empty.

Functions

func DPanic

func DPanic(args ...interface{})

DPanic is d_panic level

func DPanicf

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

DPanicf is format d_panic level

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{})

Fatal is fatal level

func Fatalf

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

Fatalf is format fatal level

func Info

func Info(args ...interface{})

Info is info level

func Infof

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

Infof is format info level

func Panic

func Panic(args ...interface{})

Panic is panic level

func Panicf

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

Panicf is format panic level

func SetLogger

func SetLogger(options ...Option) (err error)

SetLogger customize yourself logger.

func SetLoggerCallerDisable

func SetLoggerCallerDisable() (err error)

SetLoggerCallerDisable disable caller info in production env for performance improve. It is highly recommended that you execute this method in a production environment.

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 EnvLogger

type EnvLogger string
const (
	LogReleaseEnv EnvLogger = "release"
	LogDevelopEnv EnvLogger = "develop"
)

type FileLogger

type FileLogger struct {
	Filename   string
	MaxSize    int
	MaxAge     int
	MaxBackups int
	LocalTime  bool
	Compress   bool
}

type Logger

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

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

func GetLogger

func GetLogger() Logger

GetLogger get logger

type Option

type Option func(*Options)

func CallerSkip

func CallerSkip(callerSkip int) Option

func Env

func Env(env EnvLogger) Option

func FileLog

func FileLog(fileLog *FileLogger) Option

func Level

func Level(level zapcore.Level) Option

type Options

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

Jump to

Keyboard shortcuts

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