소스 검색

Improve logs readability on lic val error

gabrielseibel1 1 년 전
부모
커밋
2a6078f724
1개의 변경된 파일3개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 6
      pro/license.go

+ 3 - 6
pro/license.go

@@ -237,13 +237,10 @@ func validateLicenseKey(encryptedData []byte, publicKey *[32]byte) ([]byte, erro
 	// at this point the backend returned some undesired state
 
 	// inform failure via logs
-	err = fmt.Errorf("could not validate license with validation backend, got status code %d", validateResponse.StatusCode)
+	body, _ := io.ReadAll(validateResponse.Body)
+	err = fmt.Errorf("could not validate license with validation backend (status={%d}, body={%s})",
+		validateResponse.StatusCode, string(body))
 	slog.Warn(err.Error())
-	body, err := io.ReadAll(validateResponse.Body)
-	if err != nil {
-		slog.Warn(err.Error())
-	}
-	slog.Warn("license-validation backend response: %s", string(body))
 
 	// try to use cache if we had a temporary error
 	if code == http.StatusServiceUnavailable || code == http.StatusGatewayTimeout {