Module: RTP::Logging::ClassMethods
- Defined in:
- lib/rtp-connect/logging.rb
Overview
Class methods which the Logging module is extended with.
Defined Under Namespace
Classes: ProxyLogger
Constant Summary collapse
- @@logger =
The logger class variable (must be initialized before it is referenced by the object setter).
nil
Instance Method Summary collapse
-
#logger ⇒ ProxyLogger
The logger object getter.
-
#logger=(l) ⇒ Object
The logger object setter.
Instance Method Details
#logger ⇒ ProxyLogger
The logger object getter.
If a logger instance is not pre-defined, it sets up a Standard logger or (if in a Rails environment) the Rails logger.
112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/rtp-connect/logging.rb', line 112 def logger @@logger ||= lambda { if defined?(Rails) ProxyLogger.new(Rails.logger) else l = Logger.new(STDOUT) l.level = Logger::INFO ProxyLogger.new(l) end }.call end |
#logger=(l) ⇒ Object
The logger object setter. This method is used to replace the default logger instance with a custom logger of your own.
135 136 137 |
# File 'lib/rtp-connect/logging.rb', line 135 def logger=(l) @@logger = ProxyLogger.new(l) end |