Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A simple Resque plugin to create log files based on Resque worker queue name.
branch: master

This branch is 9 commits behind salizzar:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
spec
.gitignore
.rspec
Gemfile
README.md
Rakefile
UNLICENSE
resque-logger.gemspec

README.md

Resque Per-worker Logger Plugin

Tired of create mechanisms to isolate log files to each Resque worker in your application? The gem resque-logger gives you a simple plugin to create a log file based on queue name.

Configuration

Using a initializer

# config/initializers/resque.rb

log_path = File.join Rails.root, 'log'

config = {
  folder:     log_path,                 # destination folder
  class_name: Logger,                   # logger class name
  class_args: [ 'daily', 1.kilobyte ],  # logger additional parameters
  level:      Logger::INFO,             # optional
  formatter:  Logger::Formatter.new,    # optional
}

Resque.logger = config

Usage

Adding to a resque worker

# app/workers/my_killer_worker.rb

class MyKillerWorker
  extend Resque::Plugins::Logger

  @queue = :my_killer_worker_job

  def self.perform(args = {})
    (...)

    logger.info('it works!')

    (...)
  end
end

Dependencies

  • resque

Installation

With rubygems:

$ [sudo] gem install resque-logger

Authors

License

ResqueLogger is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying UNLICENSE file.

Something went wrong with that request. Please try again.