[#1770] logger: Refactor Logger component

Make it store its internal `zap.Logger`'s level. Also, make all the
components to accept internal `logger.Logger` instead of `zap.Logger`; it
will simplify future refactor.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-09-28 10:41:01 +03:00 committed by Pavel Karpy
parent 4baf00aa21
commit f037022a7a
83 changed files with 207 additions and 156 deletions

View file

@ -55,7 +55,7 @@ func defaultConfig() *cfg {
return &cfg{
ctx: context.Background(),
dialTimeout: defaultDialTimeout,
logger: zap.L(),
logger: &logger.Logger{Logger: zap.L()},
waitInterval: defaultWaitInterval,
signer: &transaction.Signer{
Scopes: transaction.Global,
@ -75,7 +75,7 @@ func defaultConfig() *cfg {
// - blockchain network type: netmode.PrivNet;
// - signer with the global scope;
// - wait interval: 500ms;
// - logger: zap.L().
// - logger: &logger.Logger{Logger: zap.L()}.
//
// If desired option satisfies the default value, it can be omitted.
// If multiple options of the same config value are supplied,
@ -238,7 +238,7 @@ func WithDialTimeout(dur time.Duration) Option {
//
// Ignores nil value.
//
// If option not provided, zap.L() is used.
// If option not provided, &logger.Logger{Logger: zap.L()} is used.
func WithLogger(logger *logger.Logger) Option {
return func(c *cfg) {
if logger != nil {