Skip to content

Commit

Permalink
[download] clean up log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
MalinAhlberg committed Jan 14, 2025
1 parent 3d68ebc commit 4fcabbf
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
1 change: 1 addition & 0 deletions sda-download/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func Setup() *http.Server {
router.Use(gin.LoggerWithConfig(
gin.LoggerConfig{
Formatter: func(params gin.LogFormatterParams) string {
// log if in debug mode, if a download was requested or if the request failed
if log.GetLevel() == log.DebugLevel || strings.HasPrefix(params.Path, "/s3/") || params.StatusCode >= 400 {
s, _ := json.Marshal(map[string]any{
"level": "debug",
Expand Down
3 changes: 0 additions & 3 deletions sda-download/api/sda/sda.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ func reencryptHeader(oldHeader []byte, reencKey string) ([]byte, error) {

return nil, err
}
log.Debugf("Response from the reencrypt service: %v", res)

return res.Header, nil
}
Expand Down Expand Up @@ -383,15 +382,13 @@ func Download(c *gin.Context) {
}

log.Debugf("Public key from the request header = %v", reencKey)
log.Debugf("old c4gh file header = %v\n", fileDetails.Header)
newHeader, err := reencryptHeader(fileDetails.Header, reencKey)
if err != nil {
log.Errorf("Failed to reencrypt the file header, reason: %v", err)
c.String(http.StatusInternalServerError, "file re-encryption error")

return
}
log.Debugf("Reencrypted c4gh file header = %v", newHeader)

newHr := bytes.NewReader(newHeader)

Expand Down

0 comments on commit 4fcabbf

Please sign in to comment.