module DICOM::Logging::ClassMethods
Class methods which the Logging
module is extended with.
Public Instance Methods
logger()
click to toggle source
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.
@example Inside the DICOM
module (or a class with 'include DICOM::Logging'):
logger # => Logger instance
@example Accessing from outside the DICOM
module:
DICOM.logger # => Logger instance
@return [ProxyLogger] the logger class variable
# 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)
click to toggle source
The logger object setter.
This method is used to replace the default logger instance with a custom logger of your own.
@param [Logger] l a logger instance
@example Multiple log files
# Create a logger which ages logfile once it reaches a certain size, # leaving 10 "old log files" with each file being about 1,024,000 bytes: DICOM.logger = Logger.new('foo.log', 10, 1024000)
# File lib/dicom/general/logging.rb, line 136 def logger=(l) @@logger = ProxyLogger.new(l) end