27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/pier_logging/request_logger.rb', line 27
def log(args)
return unless PierLogging.request_logger_configuration.enabled
env, status, type, body, starts_at, ends_at, _ = args
request = Rack::Request.new(env)
= (env)
info = {
message: build_message_from_request(request),
type: 'http',
duration: ((ends_at - starts_at)*1000).to_i,
context: {
user: (),
request_id: env['action_dispatch.request_id'],
correlation_id: get_correlation_id(env, )
},
request: {
headers: ,
href: request.url,
query_string: request.query_string,
body: request_body(request.path, request.body)
},
response: {
status: status,
body: response_body(request.path, body),
type: type['Content-Type'],
}
}
logger.info info
rescue StandardError => error
@logger.error(error.message)
end
|