Module: Delayed::Logging

Included in:
Pool, WorkQueue::ParentProcess::Client, WorkQueue::ParentProcess::Server, Worker
Defined in:
lib/delayed/logging.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.loggerObject


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/delayed/logging.rb', line 14

def self.logger
  return @logger if @logger
  if defined?(Rails.logger) && Rails.logger
    @logger = Rails.logger
  else
    @logger = ::Logger.new(STDOUT).tap do |logger|
      logger.formatter = ->(_, time, _, msg) {
        FORMAT % [
          time.strftime(TIMESTAMP_FORMAT),
          msg
        ]
      }
    end
  end
end

Instance Method Details

#loggerObject


30
31
32
# File 'lib/delayed/logging.rb', line 30

def logger
  Delayed::Logging.logger
end

#say(message, level = :debug) ⇒ Object


34
35
36
# File 'lib/delayed/logging.rb', line 34

def say(message, level = :debug)
  logger.send(level, message)
end