Enable console logging when server debug is enabled (#13259)

_MINIO_SERVER_DEBUG will enable console logging.
This commit is contained in:
Anis Elleuch 2021-09-21 17:01:29 +01:00 committed by GitHub
parent f492f72154
commit 565d95a377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 9 deletions

View File

@ -182,16 +182,16 @@ func initConsoleServer() (*restapi.Server, error) {
return nil, err return nil, err
} }
noLog := func(string, ...interface{}) {
// nothing to log
}
// Initialize MinIO loggers
restapi.LogInfo = noLog
restapi.LogError = noLog
api := operations.NewConsoleAPI(swaggerSpec) 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) server := restapi.NewServer(api)
// register all APIs // register all APIs