blob: 767c282d62ebc216478b00f6c2cd126e14c87075 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# frozen_string_literal: true
module Gitlab
module GrapeLogging
module Loggers
class ResponseLogger < ::GrapeLogging::Loggers::Base
def parameters(_, response)
return {} unless Feature.enabled?(:log_response_length)
response_bytes = 0
case response
when String
response_bytes = response.bytesize
else
response.each { |resp| response_bytes += resp.to_s.bytesize }
end
{
response_bytes: response_bytes
}
end
end
end
end
end
|