Class: Amazon::Coral::LogFactory
- Defined in:
- lib/amazon/coral/logfactory.rb
Overview
A simple log retrieval interface to allow injection of common logging frameworks.
Direct Known Subclasses
Constant Summary collapse
- @@instance =
LogFactory.new
Class Method Summary collapse
-
.getLog(key) ⇒ Object
Invokes the singleton LogFactory instance to retrieve a logger for a given key.
-
.setInstance(instance) ⇒ Object
Specifies a LogFactory instance which will handle log requests.
Instance Method Summary collapse
-
#getLog(key) ⇒ Object
Default logging implementation which returns a null logger.
Class Method Details
.getLog(key) ⇒ Object
Invokes the singleton LogFactory instance to retrieve a logger for a given key.
15 16 17 |
# File 'lib/amazon/coral/logfactory.rb', line 15 def LogFactory.getLog(key) return @@instance.getLog(key) end |
.setInstance(instance) ⇒ Object
Specifies a LogFactory instance which will handle log requests. Call this method early in execution prior to instantiating handlers to replace the default no-op log.
21 22 23 |
# File 'lib/amazon/coral/logfactory.rb', line 21 def LogFactory.setInstance(instance) @@instance = instance end |
Instance Method Details
#getLog(key) ⇒ Object
Default logging implementation which returns a null logger.
26 27 28 29 30 |
# File 'lib/amazon/coral/logfactory.rb', line 26 def getLog(key) log = Logger.new(nil) log.level = Logger::FATAL return log end |