From 565d95a3774fe4a9a02897e59d4e0bf842a7d980 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Tue, 21 Sep 2021 17:01:29 +0100 Subject: [PATCH] Enable console logging when server debug is enabled (#13259) _MINIO_SERVER_DEBUG will enable console logging. --- cmd/common-main.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmd/common-main.go b/cmd/common-main.go index 54d9687b9..db4e21aad 100644 --- a/cmd/common-main.go +++ b/cmd/common-main.go @@ -182,16 +182,16 @@ func initConsoleServer() (*restapi.Server, error) { return nil, err } - noLog := func(string, ...interface{}) { - // nothing to log - } - - // Initialize MinIO loggers - restapi.LogInfo = noLog - restapi.LogError = noLog - api := operations.NewConsoleAPI(swaggerSpec) - api.Logger = noLog + + if !serverDebugLog { + // Disable console logging if server debug log is not enabled + noLog := func(string, ...interface{}) {} + + restapi.LogInfo = noLog + restapi.LogError = noLog + api.Logger = noLog + } server := restapi.NewServer(api) // register all APIs