Documentation ¶
Overview ¶
Package logger logger base on zap
The differents between development logger add production logger is that development logger include caller. Thus, a production log should like {"level":"ERROR","time":"2019-07-18T03:09:46.098+0800","message":"cert and key can not be empty, failed to listen https port"} a development log should like {"level":"ERROR","time":"2019-07-18T03:12:45.599+0800","caller":"logger/logger.go:129","message":"cert and key can not be empty, failed to listen https port"}
Development logger output through log file and console Production logger output just log file
Index ¶
- func DPanic(msg string, args ...zapcore.Field)
- func DPanicf(template string, args ...interface{})
- func Error(msg string, args ...zapcore.Field)
- func Errorf(template string, args ...interface{})
- func Fatal(msg string, args ...zapcore.Field)
- func Fatalf(template string, args ...interface{})
- func Info(msg string, fields ...zapcore.Field)
- func Infof(template string, args ...interface{})
- func InitDevelopmentLogger() *zap.Logger
- func InitLogger(runmode string)
- func InitProductionLogger() *zap.Logger
- func Panic(msg string, args ...zapcore.Field)
- func Panicf(template string, args ...interface{})
- func Warn(msg string, args ...zapcore.Field)
- func Warnf(template string, args ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DPanic ¶
DPanic logs a message at DPanicLevel. The message includes any fields passed at the log site. DPanic means "development panic"
func DPanicf ¶
func DPanicf(template string, args ...interface{})
DPanicf uses fmt.Sprintf to log a templated message. In development, the logger then panics. (See DPanicLevel for details.)
func Error ¶
Error logs a message at ErrorLevel. The message includes any fields passed at the log site.
func Errorf ¶
func Errorf(template string, args ...interface{})
Errorf uses fmt.Sprintf to log a templated message.
func Fatal ¶
Fatal logs a message at FatalLevel. The message includes any fields passed at the log site.
func Fatalf ¶
func Fatalf(template string, args ...interface{})
Fatalf uses fmt.Sprintf to log a templated message, then calls os.Exit.
func Info ¶
Info logs a message at InfoLevel. The message includes any fields passed at the log site.
func Infof ¶
func Infof(template string, args ...interface{})
Infof uses fmt.Sprintf to log a templated message.
func InitDevelopmentLogger ¶
InitDevelopmentLogger init the logger for development environment
func InitProductionLogger ¶
InitProductionLogger init the logger for production environment
func Panic ¶
Panic logs a message at PanicLevel. The message includes any fields passed at the log site.
func Panicf ¶
func Panicf(template string, args ...interface{})
Panicf uses fmt.Sprintf to log a templated message, then panics.
Types ¶
This section is empty.