diff options
author | David Kim <dkim@gitlab.com> | 2020-04-03 12:46:40 +1030 |
---|---|---|
committer | David Kim <dkim@gitlab.com> | 2020-04-03 12:46:40 +1030 |
commit | 1af1245ec4a9fc330a7d4979a55a5fee1aca82cb (patch) | |
tree | 4c7d0ebe013c516f197bf117b4bcce8f53915eef /internal/command/shared/commandlogger/commandlogger.go | |
parent | 3f3a405c181840e2de13ffb22f7a50fd78054dc0 (diff) | |
download | gitlab-shell-1af1245ec4a9fc330a7d4979a55a5fee1aca82cb.tar.gz |
Add test for command logging
Diffstat (limited to 'internal/command/shared/commandlogger/commandlogger.go')
-rw-r--r-- | internal/command/shared/commandlogger/commandlogger.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/command/shared/commandlogger/commandlogger.go b/internal/command/shared/commandlogger/commandlogger.go new file mode 100644 index 0000000..017eb11 --- /dev/null +++ b/internal/command/shared/commandlogger/commandlogger.go @@ -0,0 +1,20 @@ +package commandlogger + +import ( + log "github.com/sirupsen/logrus" + pb "gitlab.com/gitlab-org/gitaly/proto/go/gitalypb" + "gitlab.com/gitlab-org/gitlab-shell/internal/gitlabnet/accessverifier" +) + +func Log(command string, repository *pb.Repository, response *accessverifier.Response, protocol string) { + fields := log.Fields{ + "command": command, + "glProjectPath": repository.GlProjectPath, + "glRepository": repository.GlRepository, + "userId": response.UserId, + "userName": response.Username, + "gitProtocol": protocol, + } + + log.WithFields(fields).Info("executing git command") +} |