diff options
author | Ash McKenzie <amckenzie@gitlab.com> | 2018-07-25 13:34:24 +1000 |
---|---|---|
committer | Ash McKenzie <amckenzie@gitlab.com> | 2018-07-25 13:42:58 +1000 |
commit | 56151ff3437629628d32a45d1e1c9b948bce7b26 (patch) | |
tree | a6f0c1fd33069fad6bb1f77cc6919efdfa5f175a | |
parent | f4cde9911ac825b6a94a9cc62fbfb5f9a6818500 (diff) | |
download | gitlab-shell-56151ff3437629628d32a45d1e1c9b948bce7b26.tar.gz |
Add and user LogHelper
-rw-r--r-- | lib/gitlab_shell.rb | 8 | ||||
-rw-r--r-- | lib/log_helper.rb | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/gitlab_shell.rb b/lib/gitlab_shell.rb index 180e5eb..cd6fcb9 100644 --- a/lib/gitlab_shell.rb +++ b/lib/gitlab_shell.rb @@ -5,10 +5,12 @@ require_relative 'gitlab_net' require_relative 'gitlab_metrics' require_relative 'current_user_helper' require_relative 'api_command_helper' +require_relative 'log_helper' class GitlabShell # rubocop:disable Metrics/ClassLength include CurrentUserHelper include APICommandHelper + include LogHelper class AccessDeniedError < StandardError; end class DisallowedCommandError < StandardError; end @@ -189,12 +191,6 @@ class GitlabShell # rubocop:disable Metrics/ClassLength GitlabNet.new end - - # User identifier to be used in log messages. - def log_username - config.audit_usernames ? username : "user with key #{key_id}" - end - def lfs_authenticate lfs_access = api.lfs_authenticate(key_id, repo_name) return unless lfs_access diff --git a/lib/log_helper.rb b/lib/log_helper.rb new file mode 100644 index 0000000..9845f76 --- /dev/null +++ b/lib/log_helper.rb @@ -0,0 +1,6 @@ +module LogHelper + # User identifier to be used in log messages. + def log_username + config.audit_usernames ? username : "user with key #{key_id}" + end +end |