Display cluster tls error only in debug mode (#4201)

Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
pull/4213/head
Hussein Galal 2021-10-13 01:10:54 +02:00 committed by GitHub
parent aa5a0a8c78
commit e7bf7b141f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package cluster
import ( import (
"context" "context"
"crypto/tls" "crypto/tls"
"io/ioutil"
"log" "log"
"net" "net"
"net/http" "net/http"
@ -78,8 +79,11 @@ func (c *Cluster) initClusterAndHTTPS(ctx context.Context) error {
// Create a HTTP server with the registered request handlers, using logrus for logging // Create a HTTP server with the registered request handlers, using logrus for logging
server := http.Server{ server := http.Server{
Handler: handler, Handler: handler}
ErrorLog: log.New(logrus.StandardLogger().Writer(), "Cluster-Http-Server ", log.LstdFlags), if logrus.IsLevelEnabled(logrus.DebugLevel) {
server.ErrorLog = log.New(logrus.StandardLogger().Writer(), "Cluster-Http-Server ", log.LstdFlags)
} else {
server.ErrorLog = log.New(ioutil.Discard, "Cluster-Http-Server", 0)
} }
// Start the supervisor http server on the tls listener // Start the supervisor http server on the tls listener