lumber 0.12.2 → 0.12.3
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/lib/lumber/level_util.rb +4 -1
- data/lib/lumber/lumber.rb +1 -1
- data/lib/lumber/version.rb +1 -1
- data/spec/level_util_spec.rb +5 -0
- metadata +9 -4
data/CHANGELOG
CHANGED
data/lib/lumber/level_util.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Lumber
|
2
2
|
module LevelUtil
|
3
3
|
|
4
|
+
# So we have a named thread and can tell which we are in Thread.list
|
5
|
+
class MonitorThread < Thread; end
|
6
|
+
|
4
7
|
extend MonitorMixin
|
5
8
|
|
6
9
|
LOG_LEVELS_KEY = "lumber:log_levels"
|
@@ -71,7 +74,7 @@ module Lumber
|
|
71
74
|
# @return [Thread] The monitor thread
|
72
75
|
#
|
73
76
|
def start_monitor(interval=10)
|
74
|
-
|
77
|
+
MonitorThread.new do
|
75
78
|
loop do
|
76
79
|
begin
|
77
80
|
activate_levels
|
data/lib/lumber/lumber.rb
CHANGED
@@ -182,7 +182,7 @@ module Lumber
|
|
182
182
|
# logger of the new class
|
183
183
|
parent = clazz.superclass
|
184
184
|
while ! parent.nil?
|
185
|
-
parent_logger_name = parent.logger.fullname
|
185
|
+
parent_logger_name = (parent.respond_to?(:logger) && parent.logger.respond_to?(:fullname)) ? parent.logger.fullname : ''
|
186
186
|
parent_is_registered = @@registered_loggers.values.find {|v| parent_logger_name.index(v) == 0}
|
187
187
|
if parent_is_registered && parent.method_defined?(:logger=)
|
188
188
|
fullname = "#{parent_logger_name}::#{clazz.name.nil? ? 'anonymous' : clazz.name.split('::').last}"
|
data/lib/lumber/version.rb
CHANGED
data/spec/level_util_spec.rb
CHANGED
@@ -121,9 +121,14 @@ describe Lumber::LevelUtil do
|
|
121
121
|
LevelUtil.activate_levels
|
122
122
|
Log4r::Logger[@name].level.should == Log4r::LNAMES.index("DEBUG")
|
123
123
|
|
124
|
+
old_size = Thread.list.size
|
124
125
|
thread = LevelUtil.start_monitor(0.1)
|
125
126
|
thread.should_not be_nil
|
126
127
|
thread.should be_alive
|
128
|
+
Thread.list.size.should == old_size + 1
|
129
|
+
|
130
|
+
# test that monitor thread has a nice name
|
131
|
+
Thread.list.collect {|t| t.to_s }.should be_any { |m| m =~ /Lumber::LevelUtil::MonitorThread/ }
|
127
132
|
|
128
133
|
Log4r::Logger[@name].level.should == Log4r::LNAMES.index("DEBUG")
|
129
134
|
LevelUtil.set_levels({@name => "ERROR"})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-09 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
@@ -233,15 +233,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
233
233
|
- - ! '>='
|
234
234
|
- !ruby/object:Gem::Version
|
235
235
|
version: '0'
|
236
|
+
segments:
|
237
|
+
- 0
|
238
|
+
hash: 2358509895133458004
|
236
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
240
|
none: false
|
238
241
|
requirements:
|
239
242
|
- - ! '>='
|
240
243
|
- !ruby/object:Gem::Version
|
241
244
|
version: '0'
|
245
|
+
segments:
|
246
|
+
- 0
|
247
|
+
hash: 2358509895133458004
|
242
248
|
requirements: []
|
243
249
|
rubyforge_project:
|
244
|
-
rubygems_version: 1.8.
|
250
|
+
rubygems_version: 1.8.24
|
245
251
|
signing_key:
|
246
252
|
specification_version: 3
|
247
253
|
summary: Lumber integrates the log4r logging system within your application.
|
@@ -252,4 +258,3 @@ test_files:
|
|
252
258
|
- spec/server_spec.rb
|
253
259
|
- spec/spec.opts
|
254
260
|
- spec/spec_helper.rb
|
255
|
-
has_rdoc:
|