debian-mirror-gitlab/lib/gitlab/grape_logging/loggers/response_logger.rb
2022-08-13 15:12:31 +05:30

19 lines
456 B
Ruby

# 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