Module: Loggability::LogClient

Defined in:
lib/loggability/logclient.rb

Overview

Methods to install for objects which call log_to.

Defined Under Namespace

Modules: InstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_host_keyObject

The key of the log host this client targets



12
13
14
# File 'lib/loggability/logclient.rb', line 12

def log_host_key
  @log_host_key
end

Instance Method Details

#inherited(subclass) ⇒ Object

Inheritance hook – set the log host key of subclasses to the same thing as the extended class.



24
25
26
27
28
29
# File 'lib/loggability/logclient.rb', line 24

def inherited( subclass )
	super
	Loggability.log.debug "Setting up subclass %p of %p to log to %p" %
		[ subclass, self, self.log_host_key ]
	subclass.log_host_key = self.log_host_key
end

#logObject

Return the Loggability::Logger object associated with the log host the client is logging to. :TODO: Use delegation for efficiency.



17
18
19
# File 'lib/loggability/logclient.rb', line 17

def log
	@__log ||= Loggability[ self ].proxy_for( self )
end