Module: Loggability::LogHost

Included in:
Loggability
Defined in:
lib/loggability/loghost.rb

Overview

Extension for ‘log hosts’. A log host is an object that hosts a Loggability::Logger object, and is typically the top of some kind of hierarchy, like a namespace module for a project:

module MyProject

end

This module isn’t mean to be used directly – it’s installed via the Loggability#log_as declaration, which also does some other initialization that you’ll likely want.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_loggerObject

The logger that will be used when the logging subsystem is reset



22
23
24
# File 'lib/loggability/loghost.rb', line 22

def default_logger
  @default_logger
end

#log_host_keyObject

The key associated with the logger for this host



29
30
31
# File 'lib/loggability/loghost.rb', line 29

def log_host_key
  @log_host_key
end

#loggerObject Also known as: log

The logger that’s currently in effect



25
26
27
# File 'lib/loggability/loghost.rb', line 25

def logger
  @logger
end

Instance Method Details

#inherited(subclass) ⇒ Object

Make subclasses log clients of the loghost.



41
42
43
44
# File 'lib/loggability/loghost.rb', line 41

def inherited( subclass )
	super
	subclass.log_to( self )
end