Skip to content

Commit 2ac7a82

Browse files
do not log random errors using Go logger
we need to make sure that we print in consistent format for the logs, remove the unnecessary logs everywhere used via `log.Print*`
1 parent 413870e commit 2ac7a82

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

pkg/subnet/subnet.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"encoding/json"
2323
"errors"
2424
"fmt"
25-
"log"
2625

2726
"github.com/minio/console/pkg/http"
2827

@@ -150,7 +149,6 @@ func ParseLicense(client http.ClientI, license string) (*licverifier.LicenseInfo
150149

151150
subnetPubKey, err := downloadSubnetPublicKey(client)
152151
if err != nil {
153-
log.Print(err)
154152
// there was an issue getting the subnet public key
155153
// use hardcoded public keys instead
156154
publicKeys = OfflinePublicKeys

restapi/configure_console.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -372,20 +372,23 @@ func handleSPA(w http.ResponseWriter, r *http.Request) {
372372
sf.ObjectBrowser = true
373373

374374
err := ValidateEncodedStyles(overridenStyles)
375-
376375
if err != nil {
377-
log.Println(err)
376+
http.Error(w, err.Error(), http.StatusInternalServerError)
377+
return
378378
} else {
379379
sf.CustomStyleOB = overridenStyles
380380
}
381381

382382
sessionID, err := login(consoleCreds, sf)
383383
if err != nil {
384-
log.Println(err)
385-
} else {
386-
cookie := NewSessionCookieForConsole(*sessionID)
387-
http.SetCookie(w, &cookie)
384+
http.Error(w, err.Error(), http.StatusInternalServerError)
385+
return
388386
}
387+
388+
cookie := NewSessionCookieForConsole(*sessionID)
389+
390+
http.SetCookie(w, &cookie)
391+
389392
// Allow us to be iframed
390393
w.Header().Del("X-Frame-Options")
391394
}

0 commit comments

Comments
 (0)