From 09c85fc3bd38c841a328a2c3e2d3a454c2629b3b Mon Sep 17 00:00:00 2001 From: Tobias Trabelsi Date: Mon, 13 Nov 2023 20:50:33 +0100 Subject: [PATCH] debug statements --- internal/woodpecker/agent.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/woodpecker/agent.go b/internal/woodpecker/agent.go index 3998ac6..f0cfac5 100644 --- a/internal/woodpecker/agent.go +++ b/internal/woodpecker/agent.go @@ -106,6 +106,9 @@ func CreateWoodpeckerAgent(cfg *config.Config) (*models.Agent, error) { bodyReader := bytes.NewReader(jsonBody) apiRoute := fmt.Sprintf("%s/api/agents", cfg.WoodpeckerInstance) + log.WithFields(log.Fields{ + "Caller": "CreateWoodpeckerAgent", + }).Debugf("Sending the following data to %s: %s", apiRoute, jsonBody) req, err := http.NewRequest(http.MethodPost, apiRoute, bodyReader) if err != nil { return nil, errors.New(fmt.Sprintf("Could not create agent request: %s", err.Error())) @@ -114,6 +117,9 @@ func CreateWoodpeckerAgent(cfg *config.Config) (*models.Agent, error) { req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", cfg.WoodpeckerApiToken)) resp, err := http.DefaultClient.Do(req) + log.WithFields(log.Fields{ + "Caller": "CreateWoodpeckerAgent", + }).Debugf("Response from woodpecker: %s", resp.Body) if err != nil { return nil, errors.New(fmt.Sprintf("Could not create new Agent: %s", err.Error())) }