From 1af1245ec4a9fc330a7d4979a55a5fee1aca82cb Mon Sep 17 00:00:00 2001 From: David Kim Date: Fri, 3 Apr 2020 12:46:40 +1030 Subject: Add test for command logging --- .../command/shared/commandlogger/commandlogger.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 internal/command/shared/commandlogger/commandlogger.go (limited to 'internal/command/shared/commandlogger/commandlogger.go') 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") +} -- cgit v1.2.1