low 0.0.14 → 0.0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/low/rack/request_logger.rb +5 -1
- data/lib/low/version.rb +1 -1
- data/spec/low/rack/request_logger_spec.rb +9 -0
- metadata +2 -2
@@ -21,7 +21,11 @@ module Low
|
|
21
21
|
|
22
22
|
def logger(env)
|
23
23
|
logger = Low::ScopedLogger.new(env['rack.errors'])
|
24
|
-
|
24
|
+
|
25
|
+
if level = env['low.log_level'] || env['log_level']
|
26
|
+
logger.level = level
|
27
|
+
end
|
28
|
+
|
25
29
|
logger.scope = env['request_id']
|
26
30
|
logger
|
27
31
|
end
|
data/lib/low/version.rb
CHANGED
@@ -18,6 +18,15 @@ describe Low::Rack::RequestLogger do
|
|
18
18
|
logger.level.should == Logger::FATAL
|
19
19
|
end
|
20
20
|
|
21
|
+
it 'should ensure rack.logger has a level even if \'low.log_level\' is not set' do
|
22
|
+
app = lambda do |env|
|
23
|
+
[200, {'Content-Type' => 'text/plain'}, env['rack.logger']]
|
24
|
+
end
|
25
|
+
rack = Low::Rack::RequestLogger.new app
|
26
|
+
response = rack.call({})
|
27
|
+
response[2].level.should_not be_nil
|
28
|
+
end
|
29
|
+
|
21
30
|
it 'should set the specified logger key' do
|
22
31
|
app = lambda do |env|
|
23
32
|
[200, {'Content-Type' => 'text/plain'}, env['another.logger']]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: low
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
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:
|
12
|
+
date: 2013-02-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rack
|