diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 18:09:09 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-19 18:09:09 +0300 |
commit | c7e385e282bcb8505589bce526e692b7bb819ffa (patch) | |
tree | 3e64affe1c2eebdcaa18cc6319b603f44b03b07e /lib/gitlab/utils | |
parent | cd3e2c7b9355f8990ab294b34b5e4add4f3985fa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/utils')
-rw-r--r-- | lib/gitlab/utils/log_limited_array.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/utils/log_limited_array.rb b/lib/gitlab/utils/log_limited_array.rb index fe8aadf9020..9c207758580 100644 --- a/lib/gitlab/utils/log_limited_array.rb +++ b/lib/gitlab/utils/log_limited_array.rb @@ -6,9 +6,9 @@ module Gitlab MAXIMUM_ARRAY_LENGTH = 10.kilobytes # Prepare an array for logging by limiting its JSON representation - # to around 10 kilobytes. Once we hit the limit, add "..." as the - # last item in the returned array. - def self.log_limited_array(array) + # to around 10 kilobytes. Once we hit the limit, add the sentinel + # value as the last item in the returned array. + def self.log_limited_array(array, sentinel: '...') return [] unless array.is_a?(Array) total_length = 0 @@ -18,7 +18,7 @@ module Gitlab total_length <= MAXIMUM_ARRAY_LENGTH end - limited_array.push('...') if total_length > MAXIMUM_ARRAY_LENGTH + limited_array.push(sentinel) if total_length > MAXIMUM_ARRAY_LENGTH limited_array end |