logging 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -189,11 +189,9 @@ module TestLogging
189
189
  assert_equal 'test_appender', @appender.name
190
190
  end
191
191
 
192
- def test_inspect
193
- expected = "<Appender:0x%x name=\"test_appender\">" % @appender.object_id
194
- assert_equal expected, @appender.inspect
192
+ def test_to_s
193
+ assert_equal "<Appender name=\"test_appender\">", @appender.to_s
195
194
  end
196
-
197
195
  end # class TestAppender
198
196
  end # module TestLogging
199
197
 
@@ -111,6 +111,15 @@ module TestLogging
111
111
  assert_raise(ArgumentError) {::Logging::Layout.new :backtrace => 'foo'}
112
112
  end
113
113
 
114
+ def test_backtrace_accessors
115
+ assert @layout.backtrace?
116
+
117
+ @layout.backtrace = :off
118
+ refute @layout.backtrace?
119
+
120
+ @layout.backtrace = 'on'
121
+ assert_equal true, @layout.backtrace
122
+ end
114
123
  end # class TestLayout
115
124
  end # module TestLogging
116
125
 
@@ -33,6 +33,16 @@ module TestLogging
33
33
  assert_nil a1.readline
34
34
  assert_nil a2.readline
35
35
 
36
+ log.add(1) { "block style message" }
37
+ assert_equal " INFO A Logger : block style message\n", a1.readline
38
+ assert_nil a1.readline
39
+ assert_nil a2.readline
40
+
41
+ log.add(1, nil, 'this should be logged (when used by Rails.logger.extend(ActiveSupport::Logger.broadcast())')
42
+ assert_equal " INFO A Logger : this should be logged (when used by Rails.logger.extend(ActiveSupport::Logger.broadcast())\n", a1.readline
43
+ assert_nil a1.readline
44
+ assert_nil a2.readline
45
+
36
46
  log.add(2,[1,2,3,4])
37
47
  assert_equal " WARN A Logger : <Array> #{[1,2,3,4]}\n", a1.readline
38
48
  assert_nil a1.readline
@@ -76,6 +86,10 @@ module TestLogging
76
86
  assert_nil a2.readline
77
87
  end
78
88
 
89
+ def test_add_block
90
+
91
+ end
92
+
79
93
  def test_add_appenders
80
94
  log = ::Logging::Logger.new 'A'
81
95
 
@@ -251,11 +265,14 @@ module TestLogging
251
265
  assert_nil a2.readline
252
266
  end
253
267
 
254
- def test_inspect
268
+ def test_inspect_matches_default
255
269
  root = ::Logging::Logger.new :root
256
270
 
257
- str = "<#{root.class.name}:0x%x name=\"#{root.name}\">" % root.object_id
258
- assert_equal str, root.inspect
271
+ # `to_s` triggers the default inspect behavior
272
+ expected = root.to_s.match(/0x[a-f\d]+/)[0]
273
+ actual = root.inspect.match(/0x[a-f\d]+/)[0]
274
+
275
+ assert_equal expected, actual
259
276
  end
260
277
 
261
278
  def test_level
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logging
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Pease
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-29 00:00:00.000000000 Z
11
+ date: 2016-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: little-plugger
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.10'
41
41
  - !ruby/object:Gem::Dependency
42
- name: flexmock
42
+ name: test-unit
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '3.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: '3.1'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bones-git
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -108,6 +108,7 @@ files:
108
108
  - examples/loggers.rb
109
109
  - examples/mdc.rb
110
110
  - examples/names.rb
111
+ - examples/rails4.rb
111
112
  - examples/rspec_integration.rb
112
113
  - examples/simple.rb
113
114
  - lib/logging.rb
@@ -142,11 +143,12 @@ files:
142
143
  - lib/spec/logging_helper.rb
143
144
  - logging.gemspec
144
145
  - script/bootstrap
146
+ - script/console
147
+ - test/appenders/test_async_flushing.rb
145
148
  - test/appenders/test_buffered_io.rb
146
149
  - test/appenders/test_console.rb
147
150
  - test/appenders/test_file.rb
148
151
  - test/appenders/test_io.rb
149
- - test/appenders/test_periodic_flushing.rb
150
152
  - test/appenders/test_rolling_file.rb
151
153
  - test/appenders/test_string_io.rb
152
154
  - test/appenders/test_syslog.rb
@@ -156,6 +158,7 @@ files:
156
158
  - test/layouts/test_json.rb
157
159
  - test/layouts/test_pattern.rb
158
160
  - test/layouts/test_yaml.rb
161
+ - test/performance.rb
159
162
  - test/setup.rb
160
163
  - test/test_appender.rb
161
164
  - test/test_color_scheme.rb
@@ -191,16 +194,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
194
  version: '0'
192
195
  requirements: []
193
196
  rubyforge_project: logging
194
- rubygems_version: 2.2.2
197
+ rubygems_version: 2.4.5.1
195
198
  signing_key:
196
199
  specification_version: 4
197
200
  summary: A flexible and extendable logging library for Ruby
198
201
  test_files:
202
+ - test/appenders/test_async_flushing.rb
199
203
  - test/appenders/test_buffered_io.rb
200
204
  - test/appenders/test_console.rb
201
205
  - test/appenders/test_file.rb
202
206
  - test/appenders/test_io.rb
203
- - test/appenders/test_periodic_flushing.rb
204
207
  - test/appenders/test_rolling_file.rb
205
208
  - test/appenders/test_string_io.rb
206
209
  - test/appenders/test_syslog.rb