loggr 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/loggr/adapter/rails.rb +6 -4
- data/lib/loggr/support/annotations.rb +1 -0
- data/lib/loggr/version.rb +1 -1
- data/test/unit/adapter/rails_test.rb +4 -1
- metadata +147 -114
data/lib/loggr/adapter/rails.rb
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'loggr/adapter/abstract'
|
2
|
+
require 'loggr/support/annotations'
|
2
3
|
|
3
4
|
module Loggr
|
4
5
|
module Adapter
|
5
|
-
|
6
|
+
|
6
7
|
# Always uses the logger defined on `Rails.logger`, CAVEAT ensure to never
|
7
8
|
# ever set `Rails.logger` to this backend, i.e.:
|
8
9
|
#
|
@@ -21,15 +22,16 @@ module Loggr
|
|
21
22
|
# config.logger = Loggr.logger('rails', :backend => Loggr::Adapter::Buffered)
|
22
23
|
#
|
23
24
|
class RailsAdapter < AbstractAdapter
|
24
|
-
|
25
|
+
|
25
26
|
# The rails backend ignores all options as it just returns
|
26
27
|
# always returns `Rails.logger` :)
|
27
28
|
#
|
29
|
+
# Ensures we get some black magic using `tagged` and `mapped`.
|
28
30
|
def logger(name, options = {})
|
29
|
-
::Rails.logger
|
31
|
+
Loggr::Support::Annotations.enhance ::Rails.logger
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
34
|
+
|
33
35
|
# THE Rails backed implementation instance
|
34
36
|
Rails = RailsAdapter.new
|
35
37
|
end
|
@@ -17,6 +17,7 @@ module Loggr
|
|
17
17
|
# to handle both `tagged` and `mapped` on the logger itself.
|
18
18
|
#
|
19
19
|
def self.enhance(logger)
|
20
|
+
return logger if logger.respond_to?(:tagged) && logger.respond_to?(:mapped)
|
20
21
|
return ::ActiveSupport::TaggedLogging.new(logger) if defined?(::ActiveSupport::TaggedLogging)
|
21
22
|
logger.send(:extend, NOPSupport)
|
22
23
|
end
|
data/lib/loggr/version.rb
CHANGED
@@ -18,12 +18,15 @@ class Loggr::Adapter::RailsTest < MiniTest::Unit::TestCase
|
|
18
18
|
@adapter = Loggr::Adapter::RailsAdapter.new
|
19
19
|
end
|
20
20
|
|
21
|
+
include Loggr::Lint::Tests
|
22
|
+
|
21
23
|
def test_rails_should_be_a_rails_adapter
|
22
24
|
assert_kind_of Loggr::Adapter::RailsAdapter, Loggr::Adapter::Rails
|
23
25
|
end
|
24
26
|
|
25
27
|
def test_should_use_same_logger_as_rails
|
26
|
-
|
28
|
+
@logger = Loggr::Adapter::Rails.logger('log')
|
29
|
+
assert_equal ::Rails.logger, as_3_2? ? @logger.instance_variable_get('@logger') : @logger
|
27
30
|
end
|
28
31
|
|
29
32
|
def test_should_default_to_rails_adapter
|
metadata
CHANGED
@@ -1,65 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 1
|
10
|
+
version: 1.1.1
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
|
-
|
13
|
+
- Lukas Westermann
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-11-30 00:00:00
|
14
|
-
default_executable:
|
18
|
+
date: 2011-11-30 00:00:00 Z
|
15
19
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: rake
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 49
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 8
|
32
|
+
- 7
|
33
|
+
version: 0.8.7
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: minitest
|
38
|
+
prerelease: false
|
39
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 3
|
45
|
+
segments:
|
46
|
+
- 2
|
47
|
+
- 3
|
48
|
+
- 0
|
49
|
+
version: 2.3.0
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: activesupport
|
54
|
+
prerelease: false
|
55
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 7
|
61
|
+
segments:
|
62
|
+
- 3
|
63
|
+
- 0
|
64
|
+
- 0
|
65
|
+
version: 3.0.0
|
66
|
+
type: :development
|
67
|
+
version_requirements: *id003
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: appraisal
|
70
|
+
prerelease: false
|
71
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
hash: 3
|
77
|
+
segments:
|
78
|
+
- 0
|
79
|
+
- 3
|
80
|
+
- 8
|
81
|
+
version: 0.3.8
|
82
|
+
type: :development
|
83
|
+
version_requirements: *id004
|
60
84
|
description: Adapters for different ruby logging backends. Create loggers using different adapters, like Logger (Stdlib), Rails or SLF4J (in JRuby only).
|
61
85
|
email:
|
62
|
-
|
86
|
+
- lukas@at-point.ch
|
63
87
|
executables: []
|
64
88
|
|
65
89
|
extensions: []
|
@@ -67,51 +91,50 @@ extensions: []
|
|
67
91
|
extra_rdoc_files: []
|
68
92
|
|
69
93
|
files:
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
has_rdoc: true
|
94
|
+
- .gitignore
|
95
|
+
- .travis.yml
|
96
|
+
- Appraisals
|
97
|
+
- Gemfile
|
98
|
+
- LICENSES.md
|
99
|
+
- MIT-LICENSE
|
100
|
+
- README.md
|
101
|
+
- Rakefile
|
102
|
+
- gemfiles/activesupport-3.0.x.gemfile
|
103
|
+
- gemfiles/activesupport-3.1.gemfile
|
104
|
+
- gemfiles/activesupport-head.gemfile
|
105
|
+
- lib/logback-classic-0.9.29.jar
|
106
|
+
- lib/logback-core-0.9.29.jar
|
107
|
+
- lib/loggr.rb
|
108
|
+
- lib/loggr/adapter.rb
|
109
|
+
- lib/loggr/adapter/abstract.rb
|
110
|
+
- lib/loggr/adapter/base.rb
|
111
|
+
- lib/loggr/adapter/buffered.rb
|
112
|
+
- lib/loggr/adapter/nop.rb
|
113
|
+
- lib/loggr/adapter/rails.rb
|
114
|
+
- lib/loggr/adapter/slf4j.rb
|
115
|
+
- lib/loggr/factory.rb
|
116
|
+
- lib/loggr/lint.rb
|
117
|
+
- lib/loggr/severity.rb
|
118
|
+
- lib/loggr/slf4j.rb
|
119
|
+
- lib/loggr/slf4j/jars.rb
|
120
|
+
- lib/loggr/slf4j/logger.rb
|
121
|
+
- lib/loggr/slf4j/mdc.rb
|
122
|
+
- lib/loggr/support/annotations.rb
|
123
|
+
- lib/loggr/version.rb
|
124
|
+
- lib/slf4j-api-1.6.1.jar
|
125
|
+
- loggr.gemspec
|
126
|
+
- test/logback_helper.rb
|
127
|
+
- test/test_helper.rb
|
128
|
+
- test/unit/adapter/abstract_test.rb
|
129
|
+
- test/unit/adapter/base_test.rb
|
130
|
+
- test/unit/adapter/buffered_test.rb
|
131
|
+
- test/unit/adapter/nop_test.rb
|
132
|
+
- test/unit/adapter/rails_test.rb
|
133
|
+
- test/unit/adapter/slf4j_test.rb
|
134
|
+
- test/unit/factory_test.rb
|
135
|
+
- test/unit/slf4j/jars_test.rb
|
136
|
+
- test/unit/slf4j/logger_test.rb
|
137
|
+
- test/unit/slf4j/mdc_test.rb
|
115
138
|
homepage: https://github.com/at-point/loggr/wiki
|
116
139
|
licenses: []
|
117
140
|
|
@@ -119,36 +142,46 @@ post_install_message:
|
|
119
142
|
rdoc_options: []
|
120
143
|
|
121
144
|
require_paths:
|
122
|
-
|
145
|
+
- lib
|
123
146
|
required_ruby_version: !ruby/object:Gem::Requirement
|
124
147
|
none: false
|
125
148
|
requirements:
|
126
|
-
|
127
|
-
|
128
|
-
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
hash: 57
|
152
|
+
segments:
|
153
|
+
- 1
|
154
|
+
- 8
|
155
|
+
- 7
|
156
|
+
version: 1.8.7
|
129
157
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
158
|
none: false
|
131
159
|
requirements:
|
132
|
-
|
133
|
-
|
134
|
-
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 23
|
163
|
+
segments:
|
164
|
+
- 1
|
165
|
+
- 3
|
166
|
+
- 6
|
167
|
+
version: 1.3.6
|
135
168
|
requirements: []
|
136
169
|
|
137
170
|
rubyforge_project:
|
138
|
-
rubygems_version: 1.
|
171
|
+
rubygems_version: 1.8.10
|
139
172
|
signing_key:
|
140
173
|
specification_version: 3
|
141
174
|
summary: Logger factory framework (including an SLF4J wrapper)
|
142
175
|
test_files:
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
176
|
+
- test/logback_helper.rb
|
177
|
+
- test/test_helper.rb
|
178
|
+
- test/unit/adapter/abstract_test.rb
|
179
|
+
- test/unit/adapter/base_test.rb
|
180
|
+
- test/unit/adapter/buffered_test.rb
|
181
|
+
- test/unit/adapter/nop_test.rb
|
182
|
+
- test/unit/adapter/rails_test.rb
|
183
|
+
- test/unit/adapter/slf4j_test.rb
|
184
|
+
- test/unit/factory_test.rb
|
185
|
+
- test/unit/slf4j/jars_test.rb
|
186
|
+
- test/unit/slf4j/logger_test.rb
|
187
|
+
- test/unit/slf4j/mdc_test.rb
|