diff options
author | Nick Thomas <nick@gitlab.com> | 2021-10-13 15:22:11 +0100 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2021-10-13 15:28:31 +0100 |
commit | 34fa7eb3499c0f85c8610f89c120c1b3c56c1462 (patch) | |
tree | e721100bcd86f394c6f13df5015d78126d005785 /internal/command/twofactorverify | |
parent | d868b40ae666a11749ee9ec652441221197a2670 (diff) | |
download | gitlab-shell-34fa7eb3499c0f85c8610f89c120c1b3c56c1462.tar.gz |
Improve logging for non-git commands499-log-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
Diffstat (limited to 'internal/command/twofactorverify')
-rw-r--r-- | internal/command/twofactorverify/twofactorverify.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/command/twofactorverify/twofactorverify.go b/internal/command/twofactorverify/twofactorverify.go index b1c5508..fe17339 100644 --- a/internal/command/twofactorverify/twofactorverify.go +++ b/internal/command/twofactorverify/twofactorverify.go @@ -5,6 +5,8 @@ import ( "fmt" "io" + "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" @@ -18,11 +20,18 @@ type Command struct { } func (c *Command) Execute(ctx context.Context) error { - err := c.verifyOTP(ctx, c.getOTP()) + ctxlog := log.ContextLogger(ctx) + ctxlog.Info("twofactorverify: execute: waiting for user input") + otp := c.getOTP() + + ctxlog.Info("twofactorverify: execute: verifying entered OTP") + err := c.verifyOTP(ctx, otp) if err != nil { + ctxlog.WithError(err).Error("twofactorverify: execute: OTP verification failed") return err } + ctxlog.WithError(err).Info("twofactorverify: execute: OTP verified") return nil } |