loggability 0.5.0 → 0.6.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 +7 -0
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/History.rdoc +6 -0
- data/Manifest.txt +0 -1
- data/lib/loggability.rb +25 -23
- data/spec/loggability_spec.rb +78 -33
- metadata +33 -56
- metadata.gz.sig +0 -0
- data/bin/loggability +0 -3
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 707e981a30301ff352ffb05f6f7dc72bad08619a
|
4
|
+
data.tar.gz: 4cbf5a409f81a94d7b1a412cf7318f276a69ddaa
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 02f841c941cff276d58fe485f39b38cdadf0d461966b1dfb24d26d2477dc2a1d1b185aba7cfddf7f3694f58dc3a84e13248be089cc6059962c72208c50511ecf
|
7
|
+
data.tar.gz: b48c93b73662f667c58b540fbc7f53e1535bd56cd37345f9d87998af731cf695af17f46295024ae274b7a2755756355586625372a0293d5994bb4e0d9bd39a3b
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/History.rdoc
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== v0.6.0 [2013-03-14] Michael Granger <ged@FaerieMUD.org>
|
2
|
+
|
3
|
+
- Give instances of loghost classes logclient instance methods (e.g., #log).
|
4
|
+
- Test under Ruby 2.0.0 by default.
|
5
|
+
|
6
|
+
|
1
7
|
== v0.5.0 [2012-08-03] Michael Granger <ged@FaerieMUD.org>
|
2
8
|
|
3
9
|
- Remove dependency on PluginFactory/Pluggability to avoid circular
|
data/Manifest.txt
CHANGED
data/lib/loggability.rb
CHANGED
@@ -9,10 +9,10 @@ require 'date'
|
|
9
9
|
module Loggability
|
10
10
|
|
11
11
|
# Package version constant
|
12
|
-
VERSION = '0.
|
12
|
+
VERSION = '0.6.0'
|
13
13
|
|
14
14
|
# VCS revision
|
15
|
-
REVISION = %q$Revision:
|
15
|
+
REVISION = %q$Revision: 5475fac60ffb $
|
16
16
|
|
17
17
|
# The key for the global logger (Loggability's own logger)
|
18
18
|
GLOBAL_KEY = :__global__
|
@@ -214,27 +214,6 @@ module Loggability
|
|
214
214
|
end # module LogHost
|
215
215
|
|
216
216
|
|
217
|
-
#
|
218
|
-
# :section: LogHost API
|
219
|
-
#
|
220
|
-
|
221
|
-
### Register as a log host associated with the given +key+, add the methods from
|
222
|
-
### LogHost, and install a Loggability::Logger.
|
223
|
-
def log_as( key )
|
224
|
-
self.extend( Loggability::LogHost )
|
225
|
-
self.log_host_key = key.to_sym
|
226
|
-
self.logger = self.default_logger = Loggability::Logger.new
|
227
|
-
Loggability.register_loghost( self )
|
228
|
-
end
|
229
|
-
|
230
|
-
# Install a global logger in Loggability itself
|
231
|
-
extend( Loggability::LogHost )
|
232
|
-
self.log_host_key = GLOBAL_KEY
|
233
|
-
self.logger = self.default_logger = Loggability::Logger.new
|
234
|
-
Loggability.register_loghost( self )
|
235
|
-
|
236
|
-
|
237
|
-
|
238
217
|
# Methods to install for objects which call +log_to+.
|
239
218
|
module LogClient
|
240
219
|
|
@@ -279,6 +258,22 @@ module Loggability
|
|
279
258
|
end # module LogClient
|
280
259
|
|
281
260
|
|
261
|
+
#
|
262
|
+
# :section: LogHost API
|
263
|
+
#
|
264
|
+
|
265
|
+
### Register as a log host associated with the given +key+, add the methods from
|
266
|
+
### LogHost, and install a Loggability::Logger.
|
267
|
+
def log_as( key )
|
268
|
+
extend( Loggability::LogHost )
|
269
|
+
include( Loggability::LogClient::InstanceMethods ) if self.is_a?( Class )
|
270
|
+
|
271
|
+
self.log_host_key = key.to_sym
|
272
|
+
self.logger = self.default_logger = Loggability::Logger.new
|
273
|
+
Loggability.register_loghost( self )
|
274
|
+
end
|
275
|
+
|
276
|
+
|
282
277
|
#
|
283
278
|
# :section: LogClient API
|
284
279
|
#
|
@@ -294,6 +289,13 @@ module Loggability
|
|
294
289
|
end
|
295
290
|
|
296
291
|
|
292
|
+
# Install a global logger in Loggability itself
|
293
|
+
extend( Loggability::LogHost )
|
294
|
+
self.log_host_key = GLOBAL_KEY
|
295
|
+
self.logger = self.default_logger = Loggability::Logger.new
|
296
|
+
Loggability.register_loghost( self )
|
297
|
+
|
298
|
+
|
297
299
|
#
|
298
300
|
# :section: Configurability Support
|
299
301
|
#
|
data/spec/loggability_spec.rb
CHANGED
@@ -38,10 +38,13 @@ describe Loggability do
|
|
38
38
|
end
|
39
39
|
|
40
40
|
|
41
|
-
context "installed in a class" do
|
41
|
+
context "installed in a class as a log host" do
|
42
42
|
|
43
43
|
before( :each ) do
|
44
|
-
@class = Class.new
|
44
|
+
@class = Class.new do
|
45
|
+
extend Loggability
|
46
|
+
log_as :testing
|
47
|
+
end
|
45
48
|
end
|
46
49
|
|
47
50
|
after( :each ) do
|
@@ -49,51 +52,83 @@ describe Loggability do
|
|
49
52
|
end
|
50
53
|
|
51
54
|
|
52
|
-
it "
|
53
|
-
@class.log_as( :testing )
|
55
|
+
it "is included in the list of log hosts" do
|
54
56
|
Loggability.log_hosts.should include( :testing => @class )
|
57
|
+
end
|
58
|
+
|
59
|
+
it "has an associated Loggability::Logger" do
|
55
60
|
@class.logger.should be_a( Loggability::Logger )
|
61
|
+
end
|
62
|
+
|
63
|
+
it "has an associated default Loggability::Logger" do
|
56
64
|
@class.default_logger.should be( @class.logger )
|
65
|
+
end
|
66
|
+
|
67
|
+
it "registers itself with the Loggability module" do
|
57
68
|
Loggability[ @class ].should be( @class.logger )
|
69
|
+
end
|
70
|
+
|
71
|
+
it "registers its key with the Loggability module" do
|
58
72
|
Loggability[ :testing ].should be( @class.logger )
|
59
73
|
end
|
60
74
|
|
61
|
-
it "
|
62
|
-
|
63
|
-
|
64
|
-
log_as :testing
|
65
|
-
end
|
66
|
-
@class.log_to( :testing )
|
67
|
-
@class.log.logger.should be( origin.logger )
|
68
|
-
Loggability[ @class ].should be( origin.logger )
|
75
|
+
it "has a proxy for its logger in its instances" do
|
76
|
+
@class.new.log.logger.should be( @class.logger )
|
77
|
+
end
|
69
78
|
|
70
|
-
|
79
|
+
it "wraps Logger instances assigned as its logger in a Loggability::Logger" do
|
80
|
+
logger = ::Logger.new( $stderr )
|
81
|
+
|
82
|
+
@class.logger = logger
|
83
|
+
@class.logger.should be_a( Loggability::Logger )
|
71
84
|
|
72
|
-
|
73
|
-
Loggability[ obj ].should be( origin.logger )
|
85
|
+
@class.log.debug "This shouldn't raise."
|
74
86
|
end
|
75
87
|
|
76
|
-
|
77
|
-
|
88
|
+
end
|
89
|
+
|
90
|
+
context "installed in a class as a logging client" do
|
91
|
+
|
92
|
+
before( :each ) do
|
93
|
+
@loghost = Module.new do
|
78
94
|
extend Loggability
|
79
95
|
log_as :testing
|
80
96
|
end
|
81
|
-
@class.log_to( :testing )
|
82
|
-
subclass = Class.new( @class )
|
83
97
|
|
84
|
-
|
85
|
-
|
98
|
+
@class = Class.new do
|
99
|
+
extend Loggability
|
100
|
+
log_to :testing
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
after( :each ) do
|
105
|
+
Loggability.clear_loghosts
|
86
106
|
end
|
87
107
|
|
88
|
-
it "wraps Logger instances assigned as its logger in a Loggability::Logger" do
|
89
|
-
@class.log_as( :testing )
|
90
108
|
|
91
|
-
|
109
|
+
it "has a proxy for its log host's logger" do
|
110
|
+
@class.log.logger.should be( @loghost.logger )
|
111
|
+
end
|
92
112
|
|
93
|
-
|
94
|
-
@class.
|
113
|
+
it "is associated with its log host's logger through the Loggability module" do
|
114
|
+
Loggability[ @class ].should be( @loghost.logger )
|
115
|
+
end
|
95
116
|
|
96
|
-
|
117
|
+
it "has a proxy for its log host's logger available from its instances" do
|
118
|
+
obj = @class.new
|
119
|
+
obj.log.logger.should be( @loghost.logger )
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
it "is associated with its log host's logger via its instances through the Loggability module" do
|
124
|
+
obj = @class.new
|
125
|
+
Loggability[ obj ].should be( @loghost.logger )
|
126
|
+
end
|
127
|
+
|
128
|
+
it "propagates its log host key to subclasses" do
|
129
|
+
subclass = Class.new( @class )
|
130
|
+
subclass.log.logger.should be( @loghost.logger )
|
131
|
+
Loggability[ subclass ].should be( @loghost.logger )
|
97
132
|
end
|
98
133
|
|
99
134
|
end
|
@@ -101,18 +136,28 @@ describe Loggability do
|
|
101
136
|
|
102
137
|
context "aggregate methods" do
|
103
138
|
|
104
|
-
|
105
|
-
|
139
|
+
before( :each ) do
|
140
|
+
Loggability.clear_loghosts
|
141
|
+
@loghost = Class.new do
|
106
142
|
extend Loggability
|
107
143
|
log_as :testing
|
108
144
|
end
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
it "can propagate a logging level to every loghost" do
|
109
149
|
Loggability.level = :warn
|
150
|
+
Loggability[ @loghost ].level.should == :warn
|
151
|
+
end
|
152
|
+
|
153
|
+
it "can propagate an outputter to every loghost" do
|
110
154
|
Loggability.output_to( $stdout )
|
111
|
-
Loggability.
|
155
|
+
Loggability[ @loghost ].logdev.dev.should be( $stdout )
|
156
|
+
end
|
112
157
|
|
113
|
-
|
114
|
-
Loggability
|
115
|
-
Loggability[
|
158
|
+
it "can propagate a formatter to every loghost" do
|
159
|
+
Loggability.format_with( :color )
|
160
|
+
Loggability[ @loghost ].formatter.should be_a( Loggability::Formatter::Color )
|
116
161
|
end
|
117
162
|
|
118
163
|
end
|
metadata
CHANGED
@@ -1,47 +1,40 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: loggability
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Michael Granger
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain:
|
12
|
-
-
|
13
|
-
|
14
|
-
|
15
|
-
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MentU59aCJtUcbxa
|
21
|
+
7kcKJhPEYsk4OdxR9q2dphNMFDQsIdRO8rywX5FRHvcb+qnXC17RvxLHtOjysPtp
|
22
|
+
EWsYoZMxyCDJpUqbwoeiM+tAHoz2ABMv3Ahie3Qeb6+MZNAtMmaWfBx3dg2u+/WN
|
23
|
+
AgMBAAGjdTBzMAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBSZ0hCV
|
24
|
+
qoHr122fGKelqffzEQBhszAcBgNVHREEFTATgRFnZWRARmFlcmllTVVELm9yZzAc
|
25
|
+
BgNVHRIEFTATgRFnZWRARmFlcmllTVVELm9yZzANBgkqhkiG9w0BAQUFAAOCAQEA
|
26
|
+
Vlcfyq6GwyE8i0QuFPCeVOwJaneSvcwx316DApjy9/tt2YD2HomLbtpXtji5QXor
|
27
|
+
ON6oln4tWBIB3Klbr3szq5oR3Rc1D02SaBTalxSndp4M6UkW9hRFu5jn98pDB4fq
|
28
|
+
5l8wMMU0Xdmqx1VYvysVAjVFVC/W4NNvlmg+2mEgSVZP5K6Tc9qDh3eMQInoYw6h
|
29
|
+
t1YA6RsUJHp5vGQyhP1x34YpLAaly8icbns/8PqOf7Osn9ztmg8bOMJCeb32eQLj
|
30
|
+
6mKCwjpegytE0oifXfF8k75A9105cBnNiMZOe1tXiqYc/exCgWvbggurzDOcRkZu
|
31
|
+
/YSusaiDXHKU2O3Akc3htA==
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
40
34
|
dependencies:
|
41
35
|
- !ruby/object:Gem::Dependency
|
42
36
|
name: hoe-mercurial
|
43
37
|
requirement: !ruby/object:Gem::Requirement
|
44
|
-
none: false
|
45
38
|
requirements:
|
46
39
|
- - ~>
|
47
40
|
- !ruby/object:Gem::Version
|
@@ -49,7 +42,6 @@ dependencies:
|
|
49
42
|
type: :development
|
50
43
|
prerelease: false
|
51
44
|
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
none: false
|
53
45
|
requirements:
|
54
46
|
- - ~>
|
55
47
|
- !ruby/object:Gem::Version
|
@@ -57,7 +49,6 @@ dependencies:
|
|
57
49
|
- !ruby/object:Gem::Dependency
|
58
50
|
name: hoe-highline
|
59
51
|
requirement: !ruby/object:Gem::Requirement
|
60
|
-
none: false
|
61
52
|
requirements:
|
62
53
|
- - ~>
|
63
54
|
- !ruby/object:Gem::Version
|
@@ -65,7 +56,6 @@ dependencies:
|
|
65
56
|
type: :development
|
66
57
|
prerelease: false
|
67
58
|
version_requirements: !ruby/object:Gem::Requirement
|
68
|
-
none: false
|
69
59
|
requirements:
|
70
60
|
- - ~>
|
71
61
|
- !ruby/object:Gem::Version
|
@@ -73,7 +63,6 @@ dependencies:
|
|
73
63
|
- !ruby/object:Gem::Dependency
|
74
64
|
name: rdoc
|
75
65
|
requirement: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
66
|
requirements:
|
78
67
|
- - ~>
|
79
68
|
- !ruby/object:Gem::Version
|
@@ -81,7 +70,6 @@ dependencies:
|
|
81
70
|
type: :development
|
82
71
|
prerelease: false
|
83
72
|
version_requirements: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
73
|
requirements:
|
86
74
|
- - ~>
|
87
75
|
- !ruby/object:Gem::Version
|
@@ -89,7 +77,6 @@ dependencies:
|
|
89
77
|
- !ruby/object:Gem::Dependency
|
90
78
|
name: hoe-deveiate
|
91
79
|
requirement: !ruby/object:Gem::Requirement
|
92
|
-
none: false
|
93
80
|
requirements:
|
94
81
|
- - ~>
|
95
82
|
- !ruby/object:Gem::Version
|
@@ -97,7 +84,6 @@ dependencies:
|
|
97
84
|
type: :development
|
98
85
|
prerelease: false
|
99
86
|
version_requirements: !ruby/object:Gem::Requirement
|
100
|
-
none: false
|
101
87
|
requirements:
|
102
88
|
- - ~>
|
103
89
|
- !ruby/object:Gem::Version
|
@@ -105,7 +91,6 @@ dependencies:
|
|
105
91
|
- !ruby/object:Gem::Dependency
|
106
92
|
name: simplecov
|
107
93
|
requirement: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
94
|
requirements:
|
110
95
|
- - ~>
|
111
96
|
- !ruby/object:Gem::Version
|
@@ -113,7 +98,6 @@ dependencies:
|
|
113
98
|
type: :development
|
114
99
|
prerelease: false
|
115
100
|
version_requirements: !ruby/object:Gem::Requirement
|
116
|
-
none: false
|
117
101
|
requirements:
|
118
102
|
- - ~>
|
119
103
|
- !ruby/object:Gem::Version
|
@@ -121,7 +105,6 @@ dependencies:
|
|
121
105
|
- !ruby/object:Gem::Dependency
|
122
106
|
name: configurability
|
123
107
|
requirement: !ruby/object:Gem::Requirement
|
124
|
-
none: false
|
125
108
|
requirements:
|
126
109
|
- - ~>
|
127
110
|
- !ruby/object:Gem::Version
|
@@ -129,7 +112,6 @@ dependencies:
|
|
129
112
|
type: :development
|
130
113
|
prerelease: false
|
131
114
|
version_requirements: !ruby/object:Gem::Requirement
|
132
|
-
none: false
|
133
115
|
requirements:
|
134
116
|
- - ~>
|
135
117
|
- !ruby/object:Gem::Version
|
@@ -137,20 +119,18 @@ dependencies:
|
|
137
119
|
- !ruby/object:Gem::Dependency
|
138
120
|
name: hoe
|
139
121
|
requirement: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
122
|
requirements:
|
142
123
|
- - ~>
|
143
124
|
- !ruby/object:Gem::Version
|
144
|
-
version: '3.
|
125
|
+
version: '3.5'
|
145
126
|
type: :development
|
146
127
|
prerelease: false
|
147
128
|
version_requirements: !ruby/object:Gem::Requirement
|
148
|
-
none: false
|
149
129
|
requirements:
|
150
130
|
- - ~>
|
151
131
|
- !ruby/object:Gem::Version
|
152
|
-
version: '3.
|
153
|
-
description:
|
132
|
+
version: '3.5'
|
133
|
+
description: "A composable logging system built on the standard Logger library.\n\nYou
|
154
134
|
can add Loggability to large libraries and systems, then hook everything\nup later
|
155
135
|
when you know where you want logs to be written, at what level of\nseverity, and
|
156
136
|
in which format.\n\nAn example:\n\n # Load a bunch of libraries that use Loggability\n
|
@@ -164,8 +144,7 @@ description: ! "A composable logging system built on the standard Logger library
|
|
164
144
|
)\n Loggability.format_as( :html )\n Loggability.level = :info"
|
165
145
|
email:
|
166
146
|
- ged@FaerieMUD.org
|
167
|
-
executables:
|
168
|
-
- loggability
|
147
|
+
executables: []
|
169
148
|
extensions: []
|
170
149
|
extra_rdoc_files:
|
171
150
|
- History.rdoc
|
@@ -177,7 +156,6 @@ files:
|
|
177
156
|
- Manifest.txt
|
178
157
|
- README.rdoc
|
179
158
|
- Rakefile
|
180
|
-
- bin/loggability
|
181
159
|
- lib/loggability.rb
|
182
160
|
- lib/loggability/constants.rb
|
183
161
|
- lib/loggability/formatter.rb
|
@@ -196,6 +174,7 @@ files:
|
|
196
174
|
homepage: http://deveiate.org/projects/loggability
|
197
175
|
licenses:
|
198
176
|
- Ruby
|
177
|
+
metadata: {}
|
199
178
|
post_install_message:
|
200
179
|
rdoc_options:
|
201
180
|
- -f
|
@@ -205,21 +184,19 @@ rdoc_options:
|
|
205
184
|
require_paths:
|
206
185
|
- lib
|
207
186
|
required_ruby_version: !ruby/object:Gem::Requirement
|
208
|
-
none: false
|
209
187
|
requirements:
|
210
|
-
- -
|
188
|
+
- - '>='
|
211
189
|
- !ruby/object:Gem::Version
|
212
190
|
version: 1.8.7
|
213
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
214
|
-
none: false
|
215
192
|
requirements:
|
216
|
-
- -
|
193
|
+
- - '>='
|
217
194
|
- !ruby/object:Gem::Version
|
218
195
|
version: '0'
|
219
196
|
requirements: []
|
220
197
|
rubyforge_project: loggability
|
221
|
-
rubygems_version:
|
198
|
+
rubygems_version: 2.0.0
|
222
199
|
signing_key:
|
223
|
-
specification_version:
|
200
|
+
specification_version: 4
|
224
201
|
summary: A composable logging system built on the standard Logger library
|
225
202
|
test_files: []
|
metadata.gz.sig
CHANGED
Binary file
|
data/bin/loggability
DELETED