summaryrefslogtreecommitdiff
path: root/internal/command/shared/commandlogger/commandlogger.go
diff options
context:
space:
mode:
authorDavid Kim <dkim@gitlab.com>2020-04-03 12:46:40 +1030
committerDavid Kim <dkim@gitlab.com>2020-04-03 12:46:40 +1030
commit1af1245ec4a9fc330a7d4979a55a5fee1aca82cb (patch)
tree4c7d0ebe013c516f197bf117b4bcce8f53915eef /internal/command/shared/commandlogger/commandlogger.go
parent3f3a405c181840e2de13ffb22f7a50fd78054dc0 (diff)
downloadgitlab-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.go20
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")
+}