datadog-json_logger 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba2bce053c01ef4787e60b782e1796f050d0d1462af869de7f09594a18bb1476
4
- data.tar.gz: 980509d54903433e0a4e755c3a2d73e96a192ad8a732bf1c119dc675846f8563
3
+ metadata.gz: 25aa55fc996314835493e0d134ffdf5c44080a36a27a3b82d21977d19623c565
4
+ data.tar.gz: 49c7e190cafd5dd5291afdb8f9baf0d0b655179e45763920fe188590f9692693
5
5
  SHA512:
6
- metadata.gz: 89da523671f52049de515a7299ab7f664d03925d777c16648de762859807c88f0fbdf3a20ed1ce438fcb4fdb9c6b459cf6674e7057a2daa62dadc65cde9b7580
7
- data.tar.gz: e75b0d5ae7c83847ebd3aeca11611f05f11a5ac4ce7edfc7cb768e7fe4b91d6451d3d5dffd2f932faf38eb7985b8e8752419b0e09e1c8309caf55fcce826bacc
6
+ metadata.gz: 9c8c19712e5653add057734e39f22c6266fd60649868cb297ac5e79aa179c695645c12111b0a1d072af24707907472720d7618872a18278926c18ab5f5bd31ef
7
+ data.tar.gz: 8975469ccdefd6b762ef0605f8c1baa0923d3a6a5d8e15f24eaa1b8bd27fd2be3b93d453fa9c23e1340c44d399a06e2dceacfd9725f26b4cea216163facba413
@@ -16,6 +16,13 @@ Gem::Specification.new do |spec|
16
16
 
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
18
 
19
+ if ENV.fetch('GEM_PUSHER', 'default') == 'github'
20
+ spec.metadata['allowed_push_host'] = 'https://rubygems.pkg.github.com/buyco'
21
+ else
22
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
23
+ end
24
+
25
+
19
26
  spec.metadata["homepage_uri"] = spec.homepage
20
27
  spec.metadata["source_code_uri"] = "https://github.com/eth3rnit3/datadog-json_logger"
21
28
  spec.metadata["changelog_uri"] = "https://github.com/eth3rnit3/datadog-json_logger/blob/main/CHANGELOG.md"
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Datadog
4
4
  module Loggers
5
- VERSION = "0.1.4"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
@@ -54,6 +54,7 @@ module Datadog
54
54
  request_ip: request.ip,
55
55
  method: request.request_method,
56
56
  controller: env["sinatra.controller_name"],
57
+ resource: env["sinatra.resource_name"] || env["sinatra.controller_name"],
57
58
  action: env["sinatra.action_name"],
58
59
  path: request.path,
59
60
  params: parse_query(request.query_string),
@@ -62,9 +63,18 @@ module Datadog
62
63
  duration: calculate_duration(start_time, end_time)
63
64
  }
64
65
 
66
+ log_data[:message] = message(log_data)
67
+
65
68
  logger.info(log_data)
66
69
  end
67
70
 
71
+ def message(log_data)
72
+ "Received #{log_data[:method]} request from #{log_data[:request_ip]} " \
73
+ "to #{log_data[:controller]}##{log_data[:action]} at #{log_data[:path]} " \
74
+ "with params #{log_data[:params].to_json}. Responded with status #{log_data[:status]} " \
75
+ "in #{log_data[:duration]}ms. Content-Type: #{log_data[:format]}."
76
+ end
77
+
68
78
  def calculate_duration(start_time, end_time)
69
79
  ((end_time - start_time) * 1000).round # Duration in milliseconds
70
80
  end
@@ -22,6 +22,8 @@ module Datadog
22
22
  def safely_process_request: (untyped env) -> untyped
23
23
 
24
24
  def log_request: (Rack::Request request, untyped env, String status, Hash[String, String] headers, Time start_time, Time end_time) -> untyped
25
+
26
+ def message: (Hash[Symbol, untyped] log_data) -> String
25
27
 
26
28
  def calculate_duration: (Time start_time, Time end_time) -> Integer
27
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: datadog-json_logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eth3rnit3