From a3d66f528aa2a8ccab41f06287429f0dd3f93e65 Mon Sep 17 00:00:00 2001 From: denis-tingaikin Date: Thu, 19 Dec 2024 01:44:30 +0300 Subject: [PATCH] use empty logger if logger was not provided Signed-off-by: denis-tingaikin --- pkg/tools/log/logger.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/tools/log/logger.go b/pkg/tools/log/logger.go index 157f5eab2..2112f09c1 100644 --- a/pkg/tools/log/logger.go +++ b/pkg/tools/log/logger.go @@ -1,6 +1,6 @@ // Copyright (c) 2021-2022 Doc.ai and/or its affiliates. // -// Copyright (c) 2023 Cisco Systems, Inc. +// Copyright (c) 2023-2024 Cisco Systems, Inc. // // SPDX-License-Identifier: Apache-2.0 // @@ -33,6 +33,7 @@ const ( var ( isTracingEnabled int32 = 0 globalLogger Logger = Default() + emptyLogger Logger = new(emptylogger) ) // Logger - unified interface for logging @@ -72,7 +73,7 @@ func FromContext(ctx context.Context) Logger { if ok { return rv } - return L() + return emptyLogger } // Join - concatenates new logger with existing loggers