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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e5baacba1e04a269ab06f2c2b64f415da9fe20b5605131c72b14f4da7f6222c
4
- data.tar.gz: ab45f9c10b79b8f22d16c4fc9a63e6adf0ad389b85664024ddff8696f56dc2b8
3
+ metadata.gz: b7f3a26ece1694377a9666295fb2bfe225045e17b5a4f1b04567de18977bec00
4
+ data.tar.gz: 6efbafac6d94f691aab6d65f429e2c85548f0c6f8b14ad789d32268d09ef049a
5
5
  SHA512:
6
- metadata.gz: 180596a41cdf18f05d7032bf6e2da5f4140ad5f5da22a62392aced9e169af4f237393bd68be274a2224e57dd05557908d2c50d0f081340c2bda951888041d52a
7
- data.tar.gz: 5697f97094cc3ae57f84ff5537d1e0665ac8f2b72437111615273f1b94d61a790d3fe220d9e9854de691bf386f877d83c53e9b04dcba84233bfe59dbcdb4983c
6
+ metadata.gz: 135fc6975975ef3267f719595f3d73976608726bf1b0a9f517238f8bde826fc63fe0451d27500464bbefd3fd26e23f4e7c4d3a2e0edb681356b00725082e468d
7
+ data.tar.gz: cad5eb073e74419f3ecfc58e8ca085eb070b444271fe01ebeb490590bc795c803300975395e54aac1fb5de52d4d58261e73d0fd6fd3449bb40c43400d9d8c726
@@ -80,11 +80,14 @@ module LogjamAgent
80
80
  return
81
81
  end
82
82
  message = message.strip
83
- if message.size > @max_line_length && severity < Logger::ERROR
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
- message[(@max_line_length-21)..-1] = " ... [LINE TRUNCATED]"
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
@@ -1,3 +1,3 @@
1
1
  module LogjamAgent
2
- VERSION = "0.26.5"
2
+ VERSION = "0.26.6"
3
3
  end
@@ -31,10 +31,17 @@ module LogjamAgent
31
31
  assert_equal "x" * 70, lines(@request).first[2]
32
32
  end
33
33
 
34
- def test_truncates_error_lines_if_message_size_id_larger_than_max_bytes_all_lines
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).first[2]
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.5
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-12 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake