slack_log_device 4.0.3 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: da610d463cc531b68e505d3fa53f6886af11cc37
4
- data.tar.gz: 3a7460a96497271af1852b431311df38a15be2f9
3
+ metadata.gz: a08add8ca43ec8b2845e209f84db5451c80b05f3
4
+ data.tar.gz: 7d9b8604965d71003b13035b4760c38314c58420
5
5
  SHA512:
6
- metadata.gz: 0aa6dbd68342d2c4d4ea0682766ddbe8384cc94ed95e9138778c5385976ccc769976cd1588e2e04f547a299e57dd4ecac278e812b2bdc0b85966692ed0269622
7
- data.tar.gz: 8fee3e4fac22a9662231004ce9cd098a0a3688218b6382e9a00b93d7216a260343625abfda335c3dbd1d0e643aa45b43c20e6fe888e7079618928185644276ca
6
+ metadata.gz: 05903e2015b349a16066c6f9aa4f5413f09d53573931f51b9b6efa5ed6108be2816ced145a668246223e6a5a7cd314fc5a04d178d40aee24dbf8aab06dcfcce5
7
+ data.tar.gz: 49374c1e5993469d1a1c2e7f80a0ec2d8bfb5b443babb7b2e6768ddf36152e8618a759cfc73b15c75eaeb99cdded92aa95ce3383791a546390658304f3f2c66d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.0.3
1
+ 4.1.0
@@ -18,10 +18,11 @@ class SlackLogDevice
18
18
  text << ':'
19
19
  if message.is_a?(Exception)
20
20
  exception = message
21
- text << " A `#{message.class}` occurred: #{convert_message(exception.message)}".rstrip
21
+ text << " A `#{exception.class}` occurred: #{convert_message(exception.message)}".rstrip
22
22
  text = truncate(text)
23
23
  text = append_metadata(text, exception)
24
- text = append_backtrace(text, exception)
24
+ text = append_exception_backtrace(text, exception)
25
+ text = append_exception_cause(text, exception)
25
26
  else
26
27
  text << " #{convert_message(message)}".rstrip
27
28
  text = append_metadata(text, message)
@@ -31,16 +32,24 @@ class SlackLogDevice
31
32
 
32
33
  private
33
34
 
34
- def append_backtrace(text, exception)
35
+ def append_exception_backtrace(text, exception)
35
36
  backtrace = format_backtrace(exception, MAX_MESSAGE_LENGTH - text.size - 2)
36
- text << "\n\n" << backtrace if backtrace.present?
37
- text
37
+ backtrace.present? ? "#{text}\n\n#{backtrace}" : text
38
+ end
39
+
40
+ def append_exception_cause(text, exception)
41
+ cause = exception.cause
42
+ return text if cause.nil?
43
+ message = "\n\nCaused by `#{exception.class}`"
44
+ return text if (text + message).size > MAX_MESSAGE_LENGTH
45
+ text = truncate("#{text}#{message}: #{exception.message}")
46
+ text = append_exception_backtrace(text, cause)
47
+ append_exception_cause(text, cause)
38
48
  end
39
49
 
40
50
  def append_metadata(text, message)
41
51
  metadata = format_metadata(message, MAX_MESSAGE_LENGTH - text.size - 2)
42
- text << "\n\n" << metadata if metadata.present?
43
- text
52
+ metadata.present? ? "#{text}\n\n#{metadata}" : text
44
53
  end
45
54
 
46
55
  def convert_message(message)
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
14
14
  s.require_paths = ['lib']
15
15
 
16
- s.required_ruby_version = '>= 2.0.0'
16
+ s.required_ruby_version = '>= 2.1.0'
17
17
 
18
18
  s.add_dependency 'activesupport', '>= 4.1.0', '< 6.0.0'
19
19
  s.add_dependency 'httparty', '>= 0.14.0', '< 0.16.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slack_log_device
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Toulotte
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -136,7 +136,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 2.0.0
139
+ version: 2.1.0
140
140
  required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  requirements:
142
142
  - - ">="
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.5.2
147
+ rubygems_version: 2.5.1
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: LogDevice for Slack