logger

package
v0.0.0-...-237b7d6 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

dateformat @author LanguageY++2013 2023/5/10 11:00 @company soulgame

logger @author LanguageY++2013 2023/5/6 14:34 @company soulgame

logger @author LanguageY++2013 2023/5/8 16:41 @company soulgame

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanic

func DPanic(args ...interface{})

DPanic uses fmt.Sprint to construct and log a message. In development, the logger then panics. (See DPanicLevel for details.)

func DPanicf

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

DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)

func DPanicw

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

DPanicw logs a message with some additional context. In development, the logger then panics. (See DPanicLevel for details.) The variadic key-value pairs are treated as they are in With.

func Debug

func Debug(args ...interface{})

Debug log to level debug

func Debugf

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

Debugf log to level debug

func Debugw

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

Debugw log to level debug

func Error

func Error(args ...interface{})

Error log to level error

func Errorf

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

Errorf log to level error

func Errorw

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

Errorw log to level error

func Fatal

func Fatal(args ...interface{})

Fatal uses fmt.Sprint to construct and log a message, then panics.

func FatalIfError

func FatalIfError(err error)

FatalIfError if err is not nil, then log to level fatal and call os.Exit

func Fatalf

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

Fatalf uses fmt.Sprintf to log a templated message, then panics.

func FatalfIf

func FatalfIf(cond bool, fmt string, args ...interface{})

FatalfIf log to level error

func Fatalw

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

Fatalw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.

func Info

func Info(args ...interface{})

Info log to level info

func Infof

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

Infof log to level info

func Infow

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

Infow log to level info

func LoadConfig

func LoadConfig(cfg LoggerConfig)

日志初始化

func NewZapLogger

func NewZapLogger(cfg LoggerConfig) (*zap.Logger, error)

func Panic

func Panic(args ...interface{})

Panic uses fmt.Sprint to construct and log a message, then panics.

func Panicf

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

Panicf uses fmt.Sprintf to log a templated message, then panics.

func Panicw

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

Panicw logs a message with some additional context, then panics. The variadic key-value pairs are treated as they are in With.

func RegisterDateformatSink

func RegisterDateformatSink()

func RegisterSinkLumberjackSink

func RegisterSinkLumberjackSink()

func Warn

func Warn(args ...interface{})

Warn log to level warn

func Warnf

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

Warnf log to level warn

func Warnw

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

Warnw log to level warn

Types

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Debugw(msg string, keysAndValues ...interface{})

	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Infow(msg string, keysAndValues ...interface{})

	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Warnw(msg string, keysAndValues ...interface{})

	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Errorw(msg string, keysAndValues ...interface{})

	DPanic(args ...interface{})
	DPanicf(format string, args ...interface{})
	DPanicw(msg string, keysAndValues ...interface{})

	Panic(v ...interface{})
	Panicf(format string, args ...interface{})
	Panicw(msg string, keysAndValues ...interface{})

	Fatal(v ...interface{})
	Fatalf(format string, args ...interface{})
	Fatalw(msg string, keysAndValues ...interface{})
}

Logger logger interface

func GlobalInstance

func GlobalInstance() Logger

type LoggerConfig

type LoggerConfig struct {
	Level       string   `mapstructure:"level"`
	Paths       []string `mapstructure:"paths"`
	Encoding    string   `mapstructure:"encoding"`
	Development bool     `mapstructure:"development"`
}

Directories

Path Synopsis
dateformat @author LanguageY++2013 2023/5/10 16:33 @company soulgame
dateformat @author LanguageY++2013 2023/5/10 16:33 @company soulgame

Jump to

Keyboard shortcuts

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