logging 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/History.txt +19 -0
- data/Rakefile +1 -1
- data/examples/rails4.rb +21 -0
- data/lib/logging/appender.rb +6 -7
- data/lib/logging/appenders/buffering.rb +127 -56
- data/lib/logging/appenders/console.rb +36 -55
- data/lib/logging/appenders/file.rb +1 -1
- data/lib/logging/appenders/io.rb +10 -7
- data/lib/logging/appenders/rolling_file.rb +2 -2
- data/lib/logging/appenders/syslog.rb +1 -1
- data/lib/logging/diagnostic_context.rb +5 -3
- data/lib/logging/layout.rb +21 -8
- data/lib/logging/layouts/pattern.rb +3 -6
- data/lib/logging/log_event.rb +1 -1
- data/lib/logging/logger.rb +109 -89
- data/lib/logging/version.rb +1 -1
- data/logging.gemspec +1 -0
- data/script/console +8 -0
- data/test/appenders/{test_periodic_flushing.rb → test_async_flushing.rb} +67 -14
- data/test/appenders/test_buffered_io.rb +6 -3
- data/test/appenders/test_console.rb +8 -0
- data/test/appenders/test_file.rb +11 -6
- data/test/appenders/test_rolling_file.rb +6 -0
- data/test/appenders/test_syslog.rb +6 -0
- data/test/benchmark.rb +42 -18
- data/test/performance.rb +66 -0
- data/test/setup.rb +20 -28
- data/test/test_appender.rb +2 -4
- data/test/test_layout.rb +9 -0
- data/test/test_logger.rb +20 -3
- metadata +11 -8
data/test/test_appender.rb
CHANGED
@@ -189,11 +189,9 @@ module TestLogging
|
|
189
189
|
assert_equal 'test_appender', @appender.name
|
190
190
|
end
|
191
191
|
|
192
|
-
def
|
193
|
-
|
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
|
|
data/test/test_layout.rb
CHANGED
@@ -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
|
|
data/test/test_logger.rb
CHANGED
@@ -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
|
268
|
+
def test_inspect_matches_default
|
255
269
|
root = ::Logging::Logger.new :root
|
256
270
|
|
257
|
-
|
258
|
-
|
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.
|
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:
|
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:
|
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
|
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
|
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.
|
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
|