mirror of
https://github.com/fhmq/hmq.git
synced 2026-08-29 22:13:11 +00:00
Plugins update log (#47)
* modify * update * add acl * add feature * update dockerfile * add deploy * update * update * plugins * plugins * update * update * update * fixed * remove * fixed * add log * update * fixed * update * fix config * add http api * add http api * resp * add config for work chan * update * fixed * update * disable trace * fixed * change acl * fixed * fixed res * dd * dd * ddd * dd * update * fixed * update * add * fixed * update key * add log * update * format * update * update auth * update * update readme * added * update * fixed * fixed * fix * upade * update * update * update
This commit is contained in:
+15
-16
@@ -29,28 +29,27 @@ func NewProdLogger() (*zap.Logger, error) {
|
||||
return logCfg.Build()
|
||||
}
|
||||
|
||||
func InitLogger(debug bool) {
|
||||
var err error
|
||||
var log *zap.Logger
|
||||
if debug {
|
||||
log, err = NewDevLogger()
|
||||
} else {
|
||||
log, err = NewProdLogger()
|
||||
}
|
||||
if err != nil {
|
||||
panic("Unable to create a logger.")
|
||||
}
|
||||
defer log.Sync()
|
||||
func Prod() *zap.Logger {
|
||||
|
||||
log.Debug("Logger initialization succeeded")
|
||||
instance = log.Named("hmq")
|
||||
l, _ := NewProdLogger()
|
||||
instance = l
|
||||
|
||||
return instance
|
||||
}
|
||||
|
||||
func Debug() *zap.Logger {
|
||||
|
||||
l, _ := NewDevLogger()
|
||||
instance = l
|
||||
|
||||
return instance
|
||||
}
|
||||
|
||||
// Get return a *zap.Logger instance
|
||||
func Get() *zap.Logger {
|
||||
if instance == nil {
|
||||
l, _ := NewProdLogger()
|
||||
return l
|
||||
instance = l
|
||||
}
|
||||
|
||||
return instance
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user