Sha256: 419c805adb134c126c567f2b8f54b41a1ff5f5bc9879aed40d1a948318793684

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

# sidekiq_middlewares
[![Build Status](https://travis-ci.org/emartech/sidekiq_middlewares.svg?branch=master)](https://travis-ci.org/emartech/sidekiq_middlewares)

Ruby Sidekiq Middlewares For common uses

### Benchmarker

#### Optiosn
* logger
  * required
  * this will be the object that must respond to :info method
* formatter
  * optional
  * this proc will receive one argument, a message object which is a Hash type
  * If the logger can handle Hash messages, such as TwP's [logging](https://github.com/TwP/logging) libary, than you don't need this

```ruby
require 'json'
require 'logger'

require 'json'
require 'logger'

json_logger = Logger.new(STDOUT)
json_logger.formatter = proc do |severity, datetime, progname, msg|
  JSON.dump(msg) + "\n"
end

Sidekiq.configure_server do |config|
  config.redis = sidekiq_redis_config

  config.server_middleware do |chain|
    chain.add SidekiqMiddlewares::Benchmarker, logger: json_logger
    # or
    # chain.add SidekiqMiddlewares::Benchmarker, logger: Logger.new(STDOUT), formatter: proc { |m| JSON.dump(m) + "\n" }
  end
end
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sidekiq_middlewares-0.1.0 README.md