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 +4 -4
- data/lib/rack/fluentd_logger.rb +5 -1
- data/lib/rack/fluentd_logger_version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b042414c5fb2a40b9b19dae74e458132480f06e15aed5b9635c1302fe84e72b5
|
4
|
+
data.tar.gz: a83997316ee12afdb8d72947025fdee4bf7f308f5ab52a8cda79806f27d4012a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18826bc50f7d912b33e8301d986a29732fd4cd6f05f6b4a28ae5bd406b6997b88e8aaf9f73580ad07d957e0e0edbb41a645d9ba6221b915385aa8f9fc7d4fd55
|
7
|
+
data.tar.gz: '09570a501e0dd26e4731a9f3f649baea7982d14e1bb7c4dfd8234ccd30f5d6fe9a4e744c53b1fee9f8d76ecb1af3eea2600076f74b22d5f4bfb61317a676db9b'
|
data/lib/rack/fluentd_logger.rb
CHANGED
@@ -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 }
|
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.
|
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-
|
11
|
+
date: 2019-03-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|