rack-fluentd-logger 0.1.3 → 0.1.4

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: 0204fc318ba727441f6ccfc3e8aa37d096af0e30ce0c90cec80ed8d800dc551b
4
- data.tar.gz: 4c4fd2a264b29efef84f2f3861fd1b992ac65da3412226c38c31a11b5fc5d532
3
+ metadata.gz: b042414c5fb2a40b9b19dae74e458132480f06e15aed5b9635c1302fe84e72b5
4
+ data.tar.gz: a83997316ee12afdb8d72947025fdee4bf7f308f5ab52a8cda79806f27d4012a
5
5
  SHA512:
6
- metadata.gz: cc5923aed0db42d798764e2680e1d734b2067c88de94f96ad88b3124903385009fc633cb17d1b7743ce7b95175fbf95b7cb7ba4147a258aa2675e02afa553c6e
7
- data.tar.gz: e9a19f9e441ebc0633f4c83771c871d7616d394988ac3f47a85c274f4d7d3a45644341baf441dc1bba3bcb09d7d48f772790df5e0395db061a52926a8c2da5f5
6
+ metadata.gz: 18826bc50f7d912b33e8301d986a29732fd4cd6f05f6b4a28ae5bd406b6997b88e8aaf9f73580ad07d957e0e0edbb41a645d9ba6221b915385aa8f9fc7d4fd55
7
+ data.tar.gz: '09570a501e0dd26e4731a9f3f649baea7982d14e1bb7c4dfd8234ccd30f5d6fe9a4e744c53b1fee9f8d76ecb1af3eea2600076f74b22d5f4bfb61317a676db9b'
@@ -15,12 +15,14 @@ module Rack
15
15
  host: ENV['FLUENTD_HOST'],
16
16
  port: (ENV['FLUENTD_PORT'] || 24_224).to_i,
17
17
  json_parser: ->(str) { JSON.parse(str) },
18
- preprocessor: ->(d) { d }
18
+ preprocessor: ->(d) { d },
19
+ max_body_non_json: 256
19
20
  )
20
21
  @logger = Fluent::Logger::FluentLogger.new(name, host: host, port: port)
21
22
 
22
23
  @json_parser = json_parser
23
24
  @preprocessor = preprocessor
25
+ @max_body_non_json = max_body_non_json
24
26
  end
25
27
  end
26
28
 
@@ -60,6 +62,8 @@ module Rack
60
62
 
61
63
  if headers['Content-Type'].start_with? 'application/json'
62
64
  body = body.map { |s| self.class.json_parser&.call(s) }
65
+ else
66
+ body = body[0..@max_body_non_json]
63
67
  end
64
68
 
65
69
  { code: code, body: body, headers: headers }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rack
4
4
  class FluentdLogger
5
- VERSION = '0.1.3'
5
+ VERSION = '0.1.4'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-fluentd-logger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Slyusarev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-22 00:00:00.000000000 Z
11
+ date: 2019-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec