11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/hubrise_initializer/lograge.rb', line 11
def custom_payload(controller)
request = controller.request
response = controller.response
= controller.request.env[HubriseInitializer::LOGRAGE_INFO_ENV] || {}
{
release: ENV["RELEASE"],
host: request.host,
ip: request.ip,
params: request.query_string.presence,
}.merge()
.merge(
if ENV["RAILS_LOGRAGE_QUERY"] == "true"
{
request_headers: (request).to_s,
request_body: truncate_body(switch_to_utf8(request.raw_post)),
response_headers: response..to_h.to_s,
response_body: truncate_body(switch_to_utf8(response.body)),
}
else
{}
end
)
end
|