Module: DICOM::Logging::ClassMethods
- Defined in:
- lib/dicom/general/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/dicom/general/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.
136 137 138 |
# File 'lib/dicom/general/logging.rb', line 136 def logger=(l) @@logger = ProxyLogger.new(l) end |