logjam_agent 0.26.5 → 0.26.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/logjam_agent/request.rb +5 -2
- data/lib/logjam_agent/version.rb +1 -1
- data/test/request_test.rb +9 -2
- 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: b7f3a26ece1694377a9666295fb2bfe225045e17b5a4f1b04567de18977bec00
|
4
|
+
data.tar.gz: 6efbafac6d94f691aab6d65f429e2c85548f0c6f8b14ad789d32268d09ef049a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 135fc6975975ef3267f719595f3d73976608726bf1b0a9f517238f8bde826fc63fe0451d27500464bbefd3fd26e23f4e7c4d3a2e0edb681356b00725082e468d
|
7
|
+
data.tar.gz: cad5eb073e74419f3ecfc58e8ca085eb070b444271fe01ebeb490590bc795c803300975395e54aac1fb5de52d4d58261e73d0fd6fd3449bb40c43400d9d8c726
|
data/lib/logjam_agent/request.rb
CHANGED
@@ -80,11 +80,14 @@ module LogjamAgent
|
|
80
80
|
return
|
81
81
|
end
|
82
82
|
message = message.strip
|
83
|
-
|
83
|
+
line_too_long = message.size > @max_line_length
|
84
|
+
if line_too_long && severity < Logger::ERROR
|
84
85
|
message[(@max_line_length-21)..-1] = " ... [LINE TRUNCATED]"
|
85
86
|
end
|
86
87
|
if (@bytes_all_lines += message.bytesize) > @max_bytes_all_lines
|
87
|
-
|
88
|
+
if line_too_long
|
89
|
+
message[(@max_line_length-21)..-1] = " ... [LINE TRUNCATED]"
|
90
|
+
end
|
88
91
|
end
|
89
92
|
@lines << [severity, format_time(timestamp), message]
|
90
93
|
end
|
data/lib/logjam_agent/version.rb
CHANGED
data/test/request_test.rb
CHANGED
@@ -31,10 +31,17 @@ module LogjamAgent
|
|
31
31
|
assert_equal "x" * 70, lines(@request).first[2]
|
32
32
|
end
|
33
33
|
|
34
|
-
def
|
34
|
+
def test_truncates_long_error_lines_if_message_size_is_larger_than_max_bytes_all_lines
|
35
35
|
@request.add_line(Logger::ERROR, Time.now, "x" * 120)
|
36
36
|
assert_equal 1, lines(@request).size
|
37
|
-
assert_equal TRUNCATED_LINE, lines(@request)
|
37
|
+
assert_equal TRUNCATED_LINE, lines(@request)[0][2]
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_truncates_long_lines_if_message_size_is_larger_than_max_bytes_all_lines
|
41
|
+
@request.add_line(Logger::INFO, Time.now, "y" * 80)
|
42
|
+
@request.add_line(Logger::ERROR, Time.now, "x" * 80)
|
43
|
+
assert_equal 2, lines(@request).size
|
44
|
+
assert_equal TRUNCATED_LINE, lines(@request)[1][2]
|
38
45
|
end
|
39
46
|
|
40
47
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logjam_agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Kaes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|