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

@@ -5,6 +5,8 @@ import (
"errors"
"io"
"net/http"
"github.com/rs/zerolog/log"
)
type GithubUserInfoResponse []struct {
@@ -23,12 +25,16 @@ func GetGithubEmail(client *http.Client) (string, error) {
return "", resErr
}
log.Debug().Msg("Got response from github")
body, bodyErr := io.ReadAll(res.Body)
if bodyErr != nil {
return "", bodyErr
}
log.Debug().Msg("Read body from github")
var emails GithubUserInfoResponse
jsonErr := json.Unmarshal(body, &emails)
@@ -37,6 +43,8 @@ func GetGithubEmail(client *http.Client) (string, error) {
return "", jsonErr
}
log.Debug().Interface("emails", emails).Msg("Parsed emails from github")
for _, email := range emails {
if email.Primary {
return email.Email, nil