diff options
author | David Kim <dkim@gitlab.com> | 2020-04-07 15:12:10 +0930 |
---|---|---|
committer | David Kim <dkim@gitlab.com> | 2020-04-07 15:16:32 +0930 |
commit | a9d9243401d887083477079192eb30452f7ccfc3 (patch) | |
tree | 3f3f6d1f8cf13978e611a3c683a904727f2ba39f /internal/handler/exec.go | |
parent | 12c6711f321dd4b0acf507041cf05fbaa623e29e (diff) | |
download | gitlab-shell-a9d9243401d887083477079192eb30452f7ccfc3.tar.gz |
Move logging to handler instead
Diffstat (limited to 'internal/handler/exec.go')
-rw-r--r-- | internal/handler/exec.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/handler/exec.go b/internal/handler/exec.go index 19621fa..977fadc 100644 --- a/internal/handler/exec.go +++ b/internal/handler/exec.go @@ -6,10 +6,14 @@ import ( "os" "strings" + log "github.com/sirupsen/logrus" + "gitlab.com/gitlab-org/gitaly/auth" "gitlab.com/gitlab-org/gitaly/client" + pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" "gitlab.com/gitlab-org/gitlab-shell/internal/config" + "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier" "gitlab.com/gitlab-org/labkit/tracing" "google.golang.org/grpc" "google.golang.org/grpc/metadata" @@ -51,6 +55,19 @@ func (gc *GitalyCommand) RunGitalyCommand(handler GitalyHandlerFunc) error { return err } +func (gc *GitalyCommand) LogExecution(command string, repository *pb.Repository, response *accessverifier.Response, protocol string) { + fields := log.Fields{ + "command": command, + "gl_project_path": repository.GlProjectPath, + "gl_repository": repository.GlRepository, + "user_id": response.UserId, + "username": response.Username, + "git_protocol": protocol, + } + + log.WithFields(fields).Info("executing git command") +} + func withOutgoingMetadata(ctx context.Context, features map[string]string) context.Context { md := metadata.New(nil) for k, v := range features { |