right_support 2.8.45 → 2.8.46

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ YzdhYjdiNTQ4MDUxMGEzNGQxZTJiMjIxNWZiMjQ1MDBkN2U2MmM4Yw==
5
+ data.tar.gz: !binary |-
6
+ Njc1MTJlMzVjOTBmZmRkNTQxNTVlYWFiMmUyNDE3Nzc0ZWZkMDVmNg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ MmY2Y2RmNThkZTFlODRjYzExMDVlZmMzYzIwY2E1ZDg3MDBlYzg3YWZiNDMy
10
+ ZjlhNzA4ODg4ZGZlYjc0YTQ1NjA0ZjlkNDhhZTU0NGExNGNmZGViMzBjMTlj
11
+ MDkxMTEyZTUzYmUzZDRlNjE2NjU1YjcyMjcxYzVjYmI4ZjIxYjA=
12
+ data.tar.gz: !binary |-
13
+ ZDY0MDM0NjkwYzJmNjA5NDY1ZTA1NDgzNTZjZGEyZDRlYTNhZWQ0YTg1N2Fi
14
+ YWQ4ZDIwMzZiMzdlN2RlOTNlYTk4ZmYzZjJjNjY1NzZhNjZiNmRkZmQ1YjIw
15
+ ZmQzMDIwMGE5YmRiM2I0ZDU2OTY3ZWU1NGQxYjJmOTJkNjRjYjk=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.8.45
1
+ 2.8.46
@@ -66,7 +66,7 @@ module RightSupport::Log
66
66
  #
67
67
  # See #info for more information.
68
68
  def debug(message = nil, &block)
69
- severity, message = filter(DEBUG, message)
69
+ severity, message = filter(DEBUG, message_to_string(message))
70
70
  meth = SEVERITY_TO_METHOD[severity]
71
71
  raise ArgumentError, "Filter emitted unknown severity #{severity.inspect}" unless meth
72
72
  @actual_logger.__send__(meth, message, &block)
@@ -77,7 +77,7 @@ module RightSupport::Log
77
77
  #
78
78
  # See #info for more information.
79
79
  def info(message = nil, &block)
80
- severity, message = filter(INFO, message)
80
+ severity, message = filter(INFO, message_to_string(message))
81
81
  meth = SEVERITY_TO_METHOD[severity]
82
82
  raise ArgumentError, "Filter emitted unknown severity #{severity.inspect}" unless meth
83
83
  @actual_logger.__send__(meth, message, &block)
@@ -88,7 +88,7 @@ module RightSupport::Log
88
88
  #
89
89
  # See #info for more information.
90
90
  def warn(message = nil, &block)
91
- severity, message = filter(WARN, message)
91
+ severity, message = filter(WARN, message_to_string(message))
92
92
  meth = SEVERITY_TO_METHOD[severity]
93
93
  raise ArgumentError, "Filter emitted unknown severity #{severity.inspect}" unless meth
94
94
  @actual_logger.__send__(meth, message, &block)
@@ -99,7 +99,7 @@ module RightSupport::Log
99
99
  #
100
100
  # See #info for more information.
101
101
  def error(message = nil, &block)
102
- severity, message = filter(ERROR, message)
102
+ severity, message = filter(ERROR, message_to_string(message))
103
103
  meth = SEVERITY_TO_METHOD[severity]
104
104
  raise ArgumentError, "Filter emitted unknown severity #{severity.inspect}" unless meth
105
105
  @actual_logger.__send__(meth, message, &block)
@@ -110,7 +110,7 @@ module RightSupport::Log
110
110
  #
111
111
  # See #info for more information.
112
112
  def fatal(message = nil, &block)
113
- severity, message = filter(FATAL, message)
113
+ severity, message = filter(FATAL, message_to_string(message))
114
114
  meth = SEVERITY_TO_METHOD[severity]
115
115
  raise ArgumentError, "Filter emitted unknown severity #{severity.inspect}" unless meth
116
116
  @actual_logger.__send__(meth, message, &block)
@@ -143,7 +143,7 @@ module RightSupport::Log
143
143
  end
144
144
  end
145
145
 
146
- severity, message = filter(severity, message)
146
+ severity, message = filter(severity, message_to_string(message))
147
147
  return @actual_logger.add(severity, message) if message
148
148
  end
149
149
 
@@ -189,12 +189,36 @@ module RightSupport::Log
189
189
  #
190
190
  # === Parameters
191
191
  # severity(Integer):: one of the severity constants defined by Logger
192
- # messgae(String):: the log message
192
+ # message(String):: the log message
193
193
  #
194
194
  # === Return
195
195
  # Returns a pair consisting of the filtered [severity, message].
196
196
  def filter(severity, message)
197
197
  return [severity, message]
198
198
  end
199
+
200
+ private
201
+
202
+ # Convert a log message to a string. If this is a string, do nothing. If it
203
+ # is an Exception, format in the same way as Ruby's Logger object. If it is
204
+ # any other kind of object, call its `inspect` method. See:
205
+ # https://github.com/ruby/ruby/blob/trunk/lib/logger.rb#L516
206
+ #
207
+ # === Parameters
208
+ # message(String):: the object to be converted
209
+ #
210
+ # === Return
211
+ # The object converted to a string.
212
+ def message_to_string(message)
213
+ case message
214
+ when ::String
215
+ message
216
+ when ::Exception
217
+ "#{message.message} (#{message.class})\n" <<
218
+ (message.backtrace || []).join("\n")
219
+ else
220
+ message.inspect
221
+ end
222
+ end
199
223
  end
200
224
  end
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: right_support 2.8.46 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "right_support"
8
- s.version = "2.8.45"
9
+ s.version = "2.8.46"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
12
- s.date = "2015-04-15"
14
+ s.date = "2015-05-29"
13
15
  s.description = "A toolkit of useful, reusable foundation code created by RightScale."
14
16
  s.email = "support@rightscale.com"
15
17
  s.extra_rdoc_files = [
@@ -146,12 +148,11 @@ Gem::Specification.new do |s|
146
148
  ]
147
149
  s.homepage = "https://github.com/rightscale/right_support"
148
150
  s.licenses = ["MIT"]
149
- s.require_paths = ["lib"]
150
- s.rubygems_version = "1.8.23"
151
+ s.rubygems_version = "2.2.2"
151
152
  s.summary = "Reusable foundation code."
152
153
 
153
154
  if s.respond_to? :specification_version then
154
- s.specification_version = 3
155
+ s.specification_version = 4
155
156
 
156
157
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
157
158
  s.add_development_dependency(%q<rake>, ["~> 10.0"])
@@ -38,4 +38,29 @@ describe RightSupport::Log::FilterLogger do
38
38
  @logger.info("")
39
39
  end
40
40
 
41
+ context 'filtering log messages' do
42
+ let(:logger) { flexmock(@logger) }
43
+ let(:info) { RightSupport::Log::FilterLogger::INFO }
44
+
45
+ context 'when the log message is a string' do
46
+ it 'passes the filter method the string' do
47
+ logger.should_receive(:filter).with(info, 'foo').once.pass_thru
48
+ logger.info('foo')
49
+ end
50
+ end
51
+
52
+ context 'when the log message is an exception' do
53
+ it 'passes the filter method a string' do
54
+ logger.should_receive(:filter).with(info, String).once.pass_thru
55
+ logger.info(StandardError.new)
56
+ end
57
+ end
58
+
59
+ context 'when the log message is any other object' do
60
+ it 'passes the filter method a string' do
61
+ logger.should_receive(:filter).with(info, String).once.pass_thru
62
+ logger.info(Object.new)
63
+ end
64
+ end
65
+ end
41
66
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.45
5
- prerelease:
4
+ version: 2.8.46
6
5
  platform: ruby
7
6
  authors:
8
7
  - Tony Spataro
@@ -14,12 +13,11 @@ authors:
14
13
  autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
- date: 2015-04-15 00:00:00.000000000 Z
16
+ date: 2015-05-29 00:00:00.000000000 Z
18
17
  dependencies:
19
18
  - !ruby/object:Gem::Dependency
20
19
  name: rake
21
20
  requirement: !ruby/object:Gem::Requirement
22
- none: false
23
21
  requirements:
24
22
  - - ~>
25
23
  - !ruby/object:Gem::Version
@@ -27,7 +25,6 @@ dependencies:
27
25
  type: :development
28
26
  prerelease: false
29
27
  version_requirements: !ruby/object:Gem::Requirement
30
- none: false
31
28
  requirements:
32
29
  - - ~>
33
30
  - !ruby/object:Gem::Version
@@ -35,7 +32,6 @@ dependencies:
35
32
  - !ruby/object:Gem::Dependency
36
33
  name: jeweler
37
34
  requirement: !ruby/object:Gem::Requirement
38
- none: false
39
35
  requirements:
40
36
  - - ~>
41
37
  - !ruby/object:Gem::Version
@@ -43,7 +39,6 @@ dependencies:
43
39
  type: :development
44
40
  prerelease: false
45
41
  version_requirements: !ruby/object:Gem::Requirement
46
- none: false
47
42
  requirements:
48
43
  - - ~>
49
44
  - !ruby/object:Gem::Version
@@ -51,7 +46,6 @@ dependencies:
51
46
  - !ruby/object:Gem::Dependency
52
47
  name: ruby-debug
53
48
  requirement: !ruby/object:Gem::Requirement
54
- none: false
55
49
  requirements:
56
50
  - - ! '>='
57
51
  - !ruby/object:Gem::Version
@@ -59,7 +53,6 @@ dependencies:
59
53
  type: :development
60
54
  prerelease: false
61
55
  version_requirements: !ruby/object:Gem::Requirement
62
- none: false
63
56
  requirements:
64
57
  - - ! '>='
65
58
  - !ruby/object:Gem::Version
@@ -67,7 +60,6 @@ dependencies:
67
60
  - !ruby/object:Gem::Dependency
68
61
  name: pry
69
62
  requirement: !ruby/object:Gem::Requirement
70
- none: false
71
63
  requirements:
72
64
  - - ! '>='
73
65
  - !ruby/object:Gem::Version
@@ -75,7 +67,6 @@ dependencies:
75
67
  type: :development
76
68
  prerelease: false
77
69
  version_requirements: !ruby/object:Gem::Requirement
78
- none: false
79
70
  requirements:
80
71
  - - ! '>='
81
72
  - !ruby/object:Gem::Version
@@ -83,7 +74,6 @@ dependencies:
83
74
  - !ruby/object:Gem::Dependency
84
75
  name: pry-byebug
85
76
  requirement: !ruby/object:Gem::Requirement
86
- none: false
87
77
  requirements:
88
78
  - - ! '>='
89
79
  - !ruby/object:Gem::Version
@@ -91,7 +81,6 @@ dependencies:
91
81
  type: :development
92
82
  prerelease: false
93
83
  version_requirements: !ruby/object:Gem::Requirement
94
- none: false
95
84
  requirements:
96
85
  - - ! '>='
97
86
  - !ruby/object:Gem::Version
@@ -233,29 +222,25 @@ files:
233
222
  homepage: https://github.com/rightscale/right_support
234
223
  licenses:
235
224
  - MIT
225
+ metadata: {}
236
226
  post_install_message:
237
227
  rdoc_options: []
238
228
  require_paths:
239
229
  - lib
240
230
  required_ruby_version: !ruby/object:Gem::Requirement
241
- none: false
242
231
  requirements:
243
232
  - - ! '>='
244
233
  - !ruby/object:Gem::Version
245
234
  version: '0'
246
- segments:
247
- - 0
248
- hash: -4527019187317914262
249
235
  required_rubygems_version: !ruby/object:Gem::Requirement
250
- none: false
251
236
  requirements:
252
237
  - - ! '>='
253
238
  - !ruby/object:Gem::Version
254
239
  version: '0'
255
240
  requirements: []
256
241
  rubyforge_project:
257
- rubygems_version: 1.8.23
242
+ rubygems_version: 2.2.2
258
243
  signing_key:
259
- specification_version: 3
244
+ specification_version: 4
260
245
  summary: Reusable foundation code.
261
246
  test_files: []