lumber 0.13.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.coveralls.yml +1 -0
- data/.travis.yml +2 -5
- data/CHANGELOG +6 -0
- data/Gemfile +3 -0
- data/lib/lumber/lumber.rb +8 -4
- data/lib/lumber/version.rb +1 -1
- data/lumber.gemspec +3 -3
- data/spec/lumber_spec.rb +1 -1
- data/spec/server_spec.rb +1 -0
- data/spec/spec_helper.rb +8 -1
- metadata +63 -59
data/.coveralls.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
service_name: travis-ci
|
data/.travis.yml
CHANGED
@@ -1,12 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.8.7
|
4
|
-
- 1.9.2
|
5
3
|
- 1.9.3
|
6
|
-
-
|
4
|
+
- 2.0.0
|
7
5
|
- jruby-19mode # JRuby in 1.9 mode
|
8
|
-
|
9
|
-
# - rbx-19mode
|
6
|
+
- rbx-19mode
|
10
7
|
before_script:
|
11
8
|
- "export DISPLAY=:99.0"
|
12
9
|
- "sh -e /etc/init.d/xvfb start"
|
data/CHANGELOG
CHANGED
data/Gemfile
CHANGED
data/lib/lumber/lumber.rb
CHANGED
@@ -65,7 +65,7 @@ module Lumber
|
|
65
65
|
end
|
66
66
|
Object.const_set('RAILS_DEFAULT_LOGGER', Log4r::Logger[BASE_LOGGER])
|
67
67
|
|
68
|
-
|
68
|
+
self.registered_loggers.clear
|
69
69
|
self.register_inheritance_handler()
|
70
70
|
|
71
71
|
if opts[:monitor_store]
|
@@ -80,6 +80,10 @@ module Lumber
|
|
80
80
|
Log4r::Logger[fullname] || Log4r::Logger.new(fullname)
|
81
81
|
end
|
82
82
|
|
83
|
+
def self.registered_loggers
|
84
|
+
@registered_loggers ||= {}
|
85
|
+
end
|
86
|
+
|
83
87
|
# Makes :logger exist independently for subclasses and sets that logger
|
84
88
|
# to one that inherits from base_class for each subclass as it is created.
|
85
89
|
# This allows you to have a finer level of control over logging, for example,
|
@@ -96,7 +100,7 @@ module Lumber
|
|
96
100
|
# so that you can tell where a log statement came from
|
97
101
|
#
|
98
102
|
def self.setup_logger_hierarchy(class_name, class_logger_fullname)
|
99
|
-
|
103
|
+
Lumber.registered_loggers[class_name] = class_logger_fullname
|
100
104
|
|
101
105
|
begin
|
102
106
|
clazz = class_name.constantize
|
@@ -142,7 +146,7 @@ module Lumber
|
|
142
146
|
|
143
147
|
# if the new class is in the list that were registered directly,
|
144
148
|
# then create their logger attribute directly, otherwise derive it
|
145
|
-
logger_name =
|
149
|
+
logger_name = Lumber.registered_loggers[subclass.name]
|
146
150
|
if logger_name
|
147
151
|
Lumber.add_lumber_logger(subclass, logger_name)
|
148
152
|
else
|
@@ -190,7 +194,7 @@ module Lumber
|
|
190
194
|
parent = clazz.superclass
|
191
195
|
while ! parent.nil?
|
192
196
|
parent_logger_name = (parent.respond_to?(:logger) && parent.logger.respond_to?(:fullname)) ? parent.logger.fullname : ''
|
193
|
-
parent_is_registered =
|
197
|
+
parent_is_registered = Lumber.registered_loggers.values.find {|v| parent_logger_name.index(v) == 0}
|
194
198
|
if parent_is_registered && parent.method_defined?(:logger=)
|
195
199
|
fullname = "#{parent_logger_name}::#{clazz.name.nil? ? 'anonymous' : clazz.name.split('::').last}"
|
196
200
|
clazz.logger = Lumber.find_or_create_logger(fullname)
|
data/lib/lumber/version.rb
CHANGED
data/lumber.gemspec
CHANGED
@@ -14,7 +14,8 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.name = "lumber"
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Lumber::VERSION
|
17
|
-
|
17
|
+
gem.license = 'MIT'
|
18
|
+
|
18
19
|
gem.add_dependency("log4r", "~> 1.1.10")
|
19
20
|
gem.add_dependency("activesupport")
|
20
21
|
gem.add_dependency("sinatra")
|
@@ -23,9 +24,8 @@ Gem::Specification.new do |gem|
|
|
23
24
|
gem.add_development_dependency("rspec")
|
24
25
|
gem.add_development_dependency("rack-test")
|
25
26
|
gem.add_development_dependency("capybara")
|
26
|
-
gem.add_development_dependency("
|
27
|
+
gem.add_development_dependency("poltergeist")
|
27
28
|
gem.add_development_dependency("awesome_print")
|
28
29
|
gem.add_development_dependency("sinatra-contrib")
|
29
|
-
# gem.add_development_dependency("simplecov")
|
30
30
|
|
31
31
|
end
|
data/spec/lumber_spec.rb
CHANGED
@@ -33,7 +33,7 @@ describe Lumber do
|
|
33
33
|
clazz.respond_to?(:logger).should be_true
|
34
34
|
lgr = clazz.logger
|
35
35
|
lgr.should be_an_instance_of(Log4r::Logger)
|
36
|
-
|
36
|
+
lgr.fullname.should == logger_name
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should not do anything if no loggers registered" do
|
data/spec/server_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,4 +1,10 @@
|
|
1
1
|
ENV['RACK_ENV'] = 'test'
|
2
|
+
|
3
|
+
if ENV['CI']
|
4
|
+
require 'coveralls'
|
5
|
+
Coveralls.wear!
|
6
|
+
end
|
7
|
+
|
2
8
|
Bundler.require(:development, :test)
|
3
9
|
Sinatra::Base.set :environment, :test
|
4
10
|
|
@@ -7,4 +13,5 @@ require "lumber/server"
|
|
7
13
|
include Lumber
|
8
14
|
|
9
15
|
require 'capybara/rspec'
|
10
|
-
|
16
|
+
require 'capybara/poltergeist'
|
17
|
+
Capybara.javascript_driver = :poltergeist
|
metadata
CHANGED
@@ -1,186 +1,184 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lumber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
prerelease:
|
5
|
+
version: 1.0.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Matt Conway
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: log4r
|
16
|
-
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ~>
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 1.1.10
|
21
21
|
none: false
|
22
|
-
|
23
|
-
type: :runtime
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
25
23
|
requirements:
|
26
24
|
- - ~>
|
27
25
|
- !ruby/object:Gem::Version
|
28
26
|
version: 1.1.10
|
29
27
|
none: false
|
28
|
+
prerelease: false
|
29
|
+
type: :runtime
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: activesupport
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
none: false
|
32
38
|
requirement: !ruby/object:Gem::Requirement
|
33
39
|
requirements:
|
34
|
-
- -
|
40
|
+
- - '>='
|
35
41
|
- !ruby/object:Gem::Version
|
36
42
|
version: '0'
|
37
43
|
none: false
|
38
44
|
prerelease: false
|
39
45
|
type: :runtime
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: sinatra
|
40
48
|
version_requirements: !ruby/object:Gem::Requirement
|
41
49
|
requirements:
|
42
|
-
- -
|
50
|
+
- - '>='
|
43
51
|
- !ruby/object:Gem::Version
|
44
52
|
version: '0'
|
45
53
|
none: false
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: sinatra
|
48
54
|
requirement: !ruby/object:Gem::Requirement
|
49
55
|
requirements:
|
50
|
-
- -
|
56
|
+
- - '>='
|
51
57
|
- !ruby/object:Gem::Version
|
52
58
|
version: '0'
|
53
59
|
none: false
|
54
60
|
prerelease: false
|
55
61
|
type: :runtime
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rake
|
56
64
|
version_requirements: !ruby/object:Gem::Requirement
|
57
65
|
requirements:
|
58
|
-
- -
|
66
|
+
- - '>='
|
59
67
|
- !ruby/object:Gem::Version
|
60
68
|
version: '0'
|
61
69
|
none: false
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rake
|
64
70
|
requirement: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- -
|
72
|
+
- - '>='
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '0'
|
69
75
|
none: false
|
70
76
|
prerelease: false
|
71
77
|
type: :development
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rspec
|
72
80
|
version_requirements: !ruby/object:Gem::Requirement
|
73
81
|
requirements:
|
74
|
-
- -
|
82
|
+
- - '>='
|
75
83
|
- !ruby/object:Gem::Version
|
76
84
|
version: '0'
|
77
85
|
none: false
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rspec
|
80
86
|
requirement: !ruby/object:Gem::Requirement
|
81
87
|
requirements:
|
82
|
-
- -
|
88
|
+
- - '>='
|
83
89
|
- !ruby/object:Gem::Version
|
84
90
|
version: '0'
|
85
91
|
none: false
|
86
92
|
prerelease: false
|
87
93
|
type: :development
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rack-test
|
88
96
|
version_requirements: !ruby/object:Gem::Requirement
|
89
97
|
requirements:
|
90
|
-
- -
|
98
|
+
- - '>='
|
91
99
|
- !ruby/object:Gem::Version
|
92
100
|
version: '0'
|
93
101
|
none: false
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rack-test
|
96
102
|
requirement: !ruby/object:Gem::Requirement
|
97
103
|
requirements:
|
98
|
-
- -
|
104
|
+
- - '>='
|
99
105
|
- !ruby/object:Gem::Version
|
100
106
|
version: '0'
|
101
107
|
none: false
|
102
108
|
prerelease: false
|
103
109
|
type: :development
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: capybara
|
104
112
|
version_requirements: !ruby/object:Gem::Requirement
|
105
113
|
requirements:
|
106
|
-
- -
|
114
|
+
- - '>='
|
107
115
|
- !ruby/object:Gem::Version
|
108
116
|
version: '0'
|
109
117
|
none: false
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: capybara
|
112
118
|
requirement: !ruby/object:Gem::Requirement
|
113
119
|
requirements:
|
114
|
-
- -
|
120
|
+
- - '>='
|
115
121
|
- !ruby/object:Gem::Version
|
116
122
|
version: '0'
|
117
123
|
none: false
|
118
124
|
prerelease: false
|
119
125
|
type: :development
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: poltergeist
|
120
128
|
version_requirements: !ruby/object:Gem::Requirement
|
121
129
|
requirements:
|
122
|
-
- -
|
130
|
+
- - '>='
|
123
131
|
- !ruby/object:Gem::Version
|
124
132
|
version: '0'
|
125
133
|
none: false
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: capybara-webkit
|
128
134
|
requirement: !ruby/object:Gem::Requirement
|
129
135
|
requirements:
|
130
|
-
- -
|
136
|
+
- - '>='
|
131
137
|
- !ruby/object:Gem::Version
|
132
138
|
version: '0'
|
133
139
|
none: false
|
134
140
|
prerelease: false
|
135
141
|
type: :development
|
142
|
+
- !ruby/object:Gem::Dependency
|
143
|
+
name: awesome_print
|
136
144
|
version_requirements: !ruby/object:Gem::Requirement
|
137
145
|
requirements:
|
138
|
-
- -
|
146
|
+
- - '>='
|
139
147
|
- !ruby/object:Gem::Version
|
140
148
|
version: '0'
|
141
149
|
none: false
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: awesome_print
|
144
150
|
requirement: !ruby/object:Gem::Requirement
|
145
151
|
requirements:
|
146
|
-
- -
|
152
|
+
- - '>='
|
147
153
|
- !ruby/object:Gem::Version
|
148
154
|
version: '0'
|
149
155
|
none: false
|
150
156
|
prerelease: false
|
151
157
|
type: :development
|
158
|
+
- !ruby/object:Gem::Dependency
|
159
|
+
name: sinatra-contrib
|
152
160
|
version_requirements: !ruby/object:Gem::Requirement
|
153
161
|
requirements:
|
154
|
-
- -
|
162
|
+
- - '>='
|
155
163
|
- !ruby/object:Gem::Version
|
156
164
|
version: '0'
|
157
165
|
none: false
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: sinatra-contrib
|
160
166
|
requirement: !ruby/object:Gem::Requirement
|
161
167
|
requirements:
|
162
|
-
- -
|
168
|
+
- - '>='
|
163
169
|
- !ruby/object:Gem::Version
|
164
170
|
version: '0'
|
165
171
|
none: false
|
166
172
|
prerelease: false
|
167
173
|
type: :development
|
168
|
-
|
169
|
-
requirements:
|
170
|
-
- - ! '>='
|
171
|
-
- !ruby/object:Gem::Version
|
172
|
-
version: '0'
|
173
|
-
none: false
|
174
|
-
description: Lumber tries to make it easy to use the more robust log4r logging system
|
175
|
-
within your rails application. To do this it sets up log4r configuration from a
|
176
|
-
yml file, and provides utility methods for adding a :logger accessor to classes
|
177
|
-
dynamicaly as they get created.
|
174
|
+
description: Lumber tries to make it easy to use the more robust log4r logging system within your rails application. To do this it sets up log4r configuration from a yml file, and provides utility methods for adding a :logger accessor to classes dynamicaly as they get created.
|
178
175
|
email:
|
179
176
|
- matt@conwaysplace.com
|
180
177
|
executables: []
|
181
178
|
extensions: []
|
182
179
|
extra_rdoc_files: []
|
183
180
|
files:
|
181
|
+
- .coveralls.yml
|
184
182
|
- .document
|
185
183
|
- .gitignore
|
186
184
|
- .idea/dictionaries/mconway.xml
|
@@ -222,27 +220,34 @@ files:
|
|
222
220
|
- spec/spec.opts
|
223
221
|
- spec/spec_helper.rb
|
224
222
|
homepage: http://github.com/wr0ngway/lumber
|
225
|
-
licenses:
|
226
|
-
|
223
|
+
licenses:
|
224
|
+
- MIT
|
225
|
+
post_install_message:
|
227
226
|
rdoc_options: []
|
228
227
|
require_paths:
|
229
228
|
- lib
|
230
229
|
required_ruby_version: !ruby/object:Gem::Requirement
|
231
230
|
requirements:
|
232
|
-
- -
|
231
|
+
- - '>='
|
233
232
|
- !ruby/object:Gem::Version
|
233
|
+
segments:
|
234
|
+
- 0
|
235
|
+
hash: 2
|
234
236
|
version: '0'
|
235
237
|
none: false
|
236
238
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
237
239
|
requirements:
|
238
|
-
- -
|
240
|
+
- - '>='
|
239
241
|
- !ruby/object:Gem::Version
|
242
|
+
segments:
|
243
|
+
- 0
|
244
|
+
hash: 2
|
240
245
|
version: '0'
|
241
246
|
none: false
|
242
247
|
requirements: []
|
243
|
-
rubyforge_project:
|
244
|
-
rubygems_version: 1.8.
|
245
|
-
signing_key:
|
248
|
+
rubyforge_project:
|
249
|
+
rubygems_version: 1.8.24
|
250
|
+
signing_key:
|
246
251
|
specification_version: 3
|
247
252
|
summary: Lumber integrates the log4r logging system within your application.
|
248
253
|
test_files:
|
@@ -252,4 +257,3 @@ test_files:
|
|
252
257
|
- spec/server_spec.rb
|
253
258
|
- spec/spec.opts
|
254
259
|
- spec/spec_helper.rb
|
255
|
-
has_rdoc:
|