loggability 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
Binary file
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == v0.2.3 [2012-05-18] Michael Granger <ged@FaerieMUD.org>
2
+
3
+ Fix logging from subclasses of log clients. Thanks to Mahlon E.
4
+ Smith for spotting this and helping to track it down.
5
+
6
+
1
7
  == v0.2.2 [2012-05-11] Michael Granger <ged@FaerieMUD.org>
2
8
 
3
9
  - Fix too-severe log messages while parsing config specs.
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.2.2'
12
+ VERSION = '0.2.3'
13
13
 
14
14
  # VCS revision
15
- REVISION = %q$Revision: e41140479376 $
15
+ REVISION = %q$Revision: 57511ffc4e23 $
16
16
 
17
17
  # The key for the global logger (Loggability's own logger)
18
18
  GLOBAL_KEY = :__global__
@@ -233,6 +233,17 @@ module Loggability
233
233
  @__log ||= Loggability[ self ].proxy_for( self )
234
234
  end
235
235
 
236
+
237
+ ### Inheritance hook -- set the log host key of subclasses to the same
238
+ ### thing as the extended class.
239
+ def inherited( subclass )
240
+ super
241
+ Loggability.log.debug "Setting up subclass %p of %p to log to %p" %
242
+ [ subclass, self, self.log_host_key ]
243
+ subclass.log_host_key = self.log_host_key
244
+ end
245
+
246
+
236
247
  # Stuff that gets added to instances of Classes that are log hosts.
237
248
  module InstanceMethods
238
249
 
@@ -72,6 +72,18 @@ describe Loggability do
72
72
  Loggability[ obj ].should be( origin.logger )
73
73
  end
74
74
 
75
+ it "propagates its log host key to subclasses" do
76
+ origin = Class.new do
77
+ extend Loggability
78
+ log_as :testing
79
+ end
80
+ @class.log_to( :testing )
81
+ subclass = Class.new( @class )
82
+
83
+ subclass.log.logger.should be( origin.logger )
84
+ Loggability[ subclass ].should be( origin.logger )
85
+ end
86
+
75
87
  end
76
88
 
77
89
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loggability
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -36,7 +36,7 @@ cert_chain:
36
36
  YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
37
37
  Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
38
38
  cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
39
- date: 2012-05-11 00:00:00.000000000 Z
39
+ date: 2012-05-19 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: pluginfactory
metadata.gz.sig CHANGED
Binary file