From 34fa7eb3499c0f85c8610f89c120c1b3c56c1462 Mon Sep 17 00:00:00 2001 From: Nick Thomas Date: Wed, 13 Oct 2021 15:22:11 +0100 Subject: Improve logging for non-git commands Several of our commands only touch the internal API, and go nowhere near Gitaly. Improve logging for each of these in a single MR. In general, we want to be able to tell what happened in the execution of each command, and to track failures down to a specific line of code. Changelog: added --- internal/command/personalaccesstoken/personalaccesstoken.go | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'internal/command/personalaccesstoken') diff --git a/internal/command/personalaccesstoken/personalaccesstoken.go b/internal/command/personalaccesstoken/personalaccesstoken.go index 6f3d03e..1942ade 100644 --- a/internal/command/personalaccesstoken/personalaccesstoken.go +++ b/internal/command/personalaccesstoken/personalaccesstoken.go @@ -8,6 +8,8 @@ import ( "strings" "time" + "gitlab.com/gitlab-org/labkit/log" + "gitlab.com/gitlab-org/gitlab-shell/internal/command/commandargs" "gitlab.com/gitlab-org/gitlab-shell/internal/command/readwriter" "gitlab.com/gitlab-org/gitlab-shell/internal/config" @@ -38,6 +40,10 @@ func (c *Command) Execute(ctx context.Context) error { return err } + log.WithContextFields(ctx, log.Fields{ + "token_args": c.TokenArgs, + }).Info("personalaccesstoken: execute: requesting token") + response, err := c.getPersonalAccessToken(ctx) if err != nil { return err -- cgit v1.2.1