issues

Github, Jira, Gitlab issues from Plan 9's acme
Log | Files | Refs | README | LICENSE

commit 35a2038f0578687a6894b44e992d1d3ecdc92575
parent 521d393bafe7353136fd8b7742e2e30ae5a898ea
Author: Oliver Lowe <o@olowe.co>
Date:   Tue, 30 Jul 2024 12:50:47 +1000

Gitlab: add debug output flag

Diffstat:
MGitlab/Gitlab.go | 3++-
MGitlab/client.go | 4++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Gitlab/Gitlab.go b/Gitlab/Gitlab.go @@ -377,11 +377,12 @@ var client *Client var hFlag = flag.String("h", "", "gitlab hostname") var tFlag = flag.String("t", "", "personal access token file") var pFlag = flag.String("p", "gitlab-org/gitlab", "project") +var debug = flag.Bool("d", false, "debug output") func main() { flag.Parse() log.SetFlags(0) - log.SetPrefix("Gitlab:") + log.SetPrefix("Gitlab: ") var tokenPath string if *tFlag != "" { tokenPath = *tFlag diff --git a/Gitlab/client.go b/Gitlab/client.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "net/url" "path" @@ -141,6 +142,9 @@ func (c *Client) do(req *http.Request) (*http.Response, error) { } req.Header.Set("Accept", "application/json") + if *debug { + log.Println(req.Method, req.URL) + } resp, err := c.Do(req) if err != nil { return nil, err