lookout-rack-utils 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +1 -0
- data/lib/lookout/rack/utils/log.rb +9 -2
- data/lib/lookout/rack/utils/version.rb +1 -1
- data/spec/log_spec.rb +45 -1
- metadata +2 -3
- data/log +0 -0
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmEzMTUxOTBmY2EyNzY2ZjA2ODQ3MWEzNjZlMzliMDg4MTc4ZmRjYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGVkYzZhMjA4ZDQ1N2NjNjQ2MzQzYzFjMGQ3ZjAyNTZkNjM0OGZlZQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZTdhOGVhZjM4NGFlMjY5ZWY3NmRmY2RmZWQxNjIzZTAyYTZhNmFkYTU4OWFk
|
10
|
+
ZDhjYTIzMWQwZjUxZmMwNjA4ZmY0YTE0MDNjMjIxZWNmOTAyZGZlOTg5MjRj
|
11
|
+
YWU1YjMwMmQxZWM1NWNlOWM4ZWViNDMyNjYwMDU2YjVhYzJmZjc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NWI2ZGRiOWE5ZGFkZGMxYWQ0YzA4NmY1NWRkNTgwMzFhZmNkYmVmMjc0NWMw
|
14
|
+
NTNlODQ1YzU1NGE4OWMyZmI5NjI0ODIxNDM2MGIzYjdkZjdhZWZlN2JhMDZj
|
15
|
+
NTQwN2Y1NzdhOWJhZDIzZTZhYWMxNGIxOTBkYTFiODgwNTgwM2Y=
|
data/.gitignore
CHANGED
@@ -73,7 +73,7 @@ module Lookout::Rack::Utils
|
|
73
73
|
|
74
74
|
if configatron.logging.enabled
|
75
75
|
index = Log4r::LNAMES.index(configatron.logging.level)
|
76
|
-
# if
|
76
|
+
# if logger.level is not in LNAMES an exception will be thrown
|
77
77
|
@logger.level = index unless index.nil?
|
78
78
|
else
|
79
79
|
@logger.level = Log4r::OFF
|
@@ -92,7 +92,7 @@ module Lookout::Rack::Utils
|
|
92
92
|
end
|
93
93
|
|
94
94
|
|
95
|
-
[:debug, :info, :warn, :error, :level].each do |method|
|
95
|
+
[:debug, :info, :warn, :error, :fatal, :level].each do |method|
|
96
96
|
define_method(method) do |*args|
|
97
97
|
if defined?(Lookout::Rack::Utils::Graphite)
|
98
98
|
unless method == :level
|
@@ -101,6 +101,13 @@ module Lookout::Rack::Utils
|
|
101
101
|
end
|
102
102
|
@logger.send(method, *args)
|
103
103
|
end
|
104
|
+
|
105
|
+
# Returns true iff the current severity level allows for
|
106
|
+
# the printing of level messages.
|
107
|
+
allow_logging = "#{method}?".to_sym
|
108
|
+
define_method(allow_logging) do |*args|
|
109
|
+
@logger.send(allow_logging, *args)
|
110
|
+
end
|
104
111
|
end
|
105
112
|
end
|
106
113
|
end
|
data/spec/log_spec.rb
CHANGED
@@ -7,7 +7,7 @@ describe Lookout::Rack::Utils::Log do
|
|
7
7
|
subject(:log) { described_class.instance }
|
8
8
|
|
9
9
|
before :all do
|
10
|
-
configatron.logging.enabled =
|
10
|
+
configatron.logging.enabled = true
|
11
11
|
configatron.logging.file = "log"
|
12
12
|
end
|
13
13
|
|
@@ -28,6 +28,13 @@ describe Lookout::Rack::Utils::Log do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
describe '.debug' do
|
32
|
+
it 'should log a graphite stat' do
|
33
|
+
Lookout::Rack::Utils::Graphite.should_receive(:increment).with('log.debug')
|
34
|
+
log.debug 'foo'
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
31
38
|
describe '.info' do
|
32
39
|
it 'should log a graphite stat' do
|
33
40
|
Lookout::Rack::Utils::Graphite.should_receive(:increment).with('log.info')
|
@@ -48,6 +55,43 @@ describe Lookout::Rack::Utils::Log do
|
|
48
55
|
log.error 'foo'
|
49
56
|
end
|
50
57
|
end
|
58
|
+
|
59
|
+
describe '.fatal' do
|
60
|
+
it 'should log a graphite stat' do
|
61
|
+
Lookout::Rack::Utils::Graphite.should_receive(:increment).with('log.fatal')
|
62
|
+
log.fatal 'foo'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '.debug?' do
|
67
|
+
it 'returns true when level is debug' do
|
68
|
+
expect(log.debug?).to eq(true)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
describe '.info?' do
|
73
|
+
it 'returns true when level is info' do
|
74
|
+
expect(log.info?).to eq(true)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe '.warn?' do
|
79
|
+
it 'returns true when level is warn' do
|
80
|
+
expect(log.warn?).to eq(true)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
describe '.error?' do
|
85
|
+
it 'returns true when level is error' do
|
86
|
+
expect(log.error?).to eq(true)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
describe '.fatal?' do
|
91
|
+
it 'returns true when level is fatal' do
|
92
|
+
expect(log.fatal?).to eq(true)
|
93
|
+
end
|
94
|
+
end
|
51
95
|
end
|
52
96
|
|
53
97
|
describe Lookout::Rack::Utils::Log::LookoutFormatter do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lookout-rack-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ian Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -211,7 +211,6 @@ files:
|
|
211
211
|
- lib/lookout/rack/utils/request.rb
|
212
212
|
- lib/lookout/rack/utils/subroute.rb
|
213
213
|
- lib/lookout/rack/utils/version.rb
|
214
|
-
- log
|
215
214
|
- lookout-rack-utils.gemspec
|
216
215
|
- spec/graphite_spec.rb
|
217
216
|
- spec/i18n_spec.rb
|
data/log
DELETED
File without changes
|