diff options
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 { |