[logging] feat: simplified the names

This commit is contained in:
Simon Cornet 2025-03-06 08:49:31 +01:00
commit e32fb792f6
6 changed files with 38 additions and 38 deletions

View file

@ -28,16 +28,16 @@ func fetchRepositoriesGitlab() ([]Repository, error) {
url := fmt.Sprintf("https://%s/api/v4/projects?%s&%s&%s%s",
gitlabHost, membership, order, perpage, archived)
logging.LogPrint(debug, "HTTP: Creating API request", nil)
logging.Print(debug, "HTTP: Creating API request", nil)
req, err := http.NewRequest("GET", url, nil)
if err != nil {
return nil, fmt.Errorf("ERROR: creating request: %v\n", err)
}
logging.LogPrint(debug, "HTTP: Adding PRIVATE-TOKEN header to API request", nil)
logging.Print(debug, "HTTP: Adding PRIVATE-TOKEN header to API request", nil)
req.Header.Set("PRIVATE-TOKEN", gitlabToken)
logging.LogPrint(debug, "HTTP: Making request", nil)
logging.Print(debug, "HTTP: Making request", nil)
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
@ -49,7 +49,7 @@ func fetchRepositoriesGitlab() ([]Repository, error) {
return nil, fmt.Errorf("ERROR: API request failed with status: %d\n", resp.StatusCode)
}
logging.LogPrint(debug, "HTTP: Decoding JSON response", nil)
logging.Print(debug, "HTTP: Decoding JSON response", nil)
var repositories []Repository
if err := json.NewDecoder(resp.Body).Decode(&repositories); err != nil {
return nil, fmt.Errorf("ERROR: decoding response: %v\n", err)
@ -62,10 +62,10 @@ func fetchRepositoriesGitlab() ([]Repository, error) {
repoCount := len(repositories)
err = bar.Set(0)
if err != nil {
logging.LogFatal("Could not reset the progressbar", err)
logging.Fatal("Could not reset the progressbar", err)
}
bar.ChangeMax(repoCount)
logging.LogPrint(debug, "HTTP: Returning repositories found", nil)
logging.Print(debug, "HTTP: Returning repositories found", nil)
return repositories, nil
}