From 8fd8bdcb39ec574b0e04a98b864a56e41b0b0e43 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 24 Jul 2021 15:22:01 +0300 Subject: [PATCH] logger: fix default logger funcs Signed-off-by: Vasiliy Tolstov --- logger/default.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/logger/default.go b/logger/default.go index 6623d4a1..263426ee 100644 --- a/logger/default.go +++ b/logger/default.go @@ -35,9 +35,6 @@ func (l *defaultLogger) Init(opts ...Option) error { o(&l.opts) } l.enc = json.NewEncoder(l.opts.Out) - - l.logFunc = l.Log - l.logfFunc = l.Logf // wrap the Log func for i := len(l.opts.Wrappers); i > 0; i-- { l.logFunc = l.opts.Wrappers[i-1].Log(l.logFunc) @@ -218,7 +215,11 @@ func (l *defaultLogger) Options() Options { // NewLogger builds a new logger based on options func NewLogger(opts ...Option) Logger { - l := &defaultLogger{opts: NewOptions(opts...)} + l := &defaultLogger{ + opts: NewOptions(opts...), + } + l.logFunc = l.Log + l.logfFunc = l.Logf l.enc = json.NewEncoder(l.opts.Out) return l }