debian-mirror-gitlab/lib/gitlab/grape_logging/loggers/response_logger.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
456 B
Ruby
Raw Normal View History

2022-08-13 15:12:31 +05:30
# 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
response.each { |resp| response_bytes += resp.to_s.bytesize }
{
response_bytes: response_bytes
}
end
end
end
end
end