Module: LogWeasel::Resque

Defined in:
lib/log_weasel/resque.rb

Defined Under Namespace

Modules: Callbacks, ClassMethods, Job, Worker

Class Method Summary collapse

Class Method Details

.initialize!(options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/log_weasel/resque.rb', line 3

def self.initialize!(options = {})
  ::Resque::Worker.send(:include, LogWeasel::Resque::Worker)
  ::Resque::Job.send(:include, LogWeasel::Resque::Job)
  ::Resque.extend(LogWeasel::Resque::ClassMethods)

  key = LogWeasel.config.key ? "#{LogWeasel.config.key}-RESQUE" : "RESQUE"

  ::Resque.after_fork do |job|
    LogWeasel::Resque::Callbacks.after_fork job, key
  end

  ::Resque.before_push do |queue, item|
    LogWeasel::Resque::Callbacks.before_push queue, item, key
  end
end