mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-23 21:44:41 +02:00
feat(logger): add logger option to all micro components (override DefaultLogger) closes #2556 (#2559)
* feat(logger): add logger option to all components * fix: refactor api/rpc.go * fix: refactor api/stream.go * fix: api/options.go comment * fix(logger): do not use logger.Helper internally * fix(logger): fix comments * fix(logger): use level.Enabled method * fix: rename mlogger to log * fix: run go fmt * fix: log level * fix: factories Co-authored-by: Mohamed MHAMDI <mmhamdi@hubside.com> Co-authored-by: Davincible <david.brouwer.99@gmail.com>
This commit is contained in:
@@ -129,3 +129,10 @@ func (h *Helper) WithError(err error) *Helper {
|
||||
func (h *Helper) WithFields(fields map[string]interface{}) *Helper {
|
||||
return &Helper{logger: h.logger.Fields(fields)}
|
||||
}
|
||||
|
||||
func HelperOrDefault(h *Helper) *Helper {
|
||||
if h == nil {
|
||||
return DefaultHelper
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user