feat: add debug log level

This commit is contained in:
Stavros
2025-01-26 20:23:09 +02:00
parent 94f7debb10
commit 08d382c981
10 changed files with 119 additions and 1 deletions

View File

@@ -4,6 +4,8 @@ import (
"encoding/json"
"io"
"net/http"
"github.com/rs/zerolog/log"
)
type GenericUserInfoResponse struct {
@@ -17,12 +19,16 @@ func GetGenericEmail(client *http.Client, url string) (string, error) {
return "", resErr
}
log.Debug().Msg("Got response from generic provider")
body, bodyErr := io.ReadAll(res.Body)
if bodyErr != nil {
return "", bodyErr
}
log.Debug().Msg("Read body from generic provider")
var user GenericUserInfoResponse
jsonErr := json.Unmarshal(body, &user)
@@ -31,5 +37,7 @@ func GetGenericEmail(client *http.Client, url string) (string, error) {
return "", jsonErr
}
log.Debug().Interface("user", user).Msg("Parsed user from generic provider")
return user.Email, nil
}