Sha256: 55271d2c306b82d86f6b74c937d0c305603c55a09ffc04fbbe2af655b34a75f9

Contents?: true

Size: 616 Bytes

Versions: 41

Compression:

Stored size: 616 Bytes

Contents

class SidekiqLogsterReporter
  def call(ex, context={})
    # Pass context to Logster
    fake_env = {}
    context.each do |key, value|
      Logster.add_to_env(fake_env, key, value)
    end

    text = "Job exception: #{ex}\n"
    if ex.backtrace
      Logster.add_to_env(fake_env, :backtrace, ex.backtrace)
    end

    Thread.current[Logster::Logger::LOGSTER_ENV] = fake_env
    Logster.logger.error(text)
  rescue => e
    Logster.logger.fatal("Failed to log exception #{ex} #{hash}\nReason: #{e.class} #{e}\n#{e.backtrace.join("\n")}")
  ensure
    Thread.current[Logster::Logger::LOGSTER_ENV] = nil
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
logster-0.8.4.7.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.6.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.5.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.4.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.3.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.2.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.1.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.8.3 lib/examples/sidekiq_logster_reporter.rb
logster-0.8.2 lib/examples/sidekiq_logster_reporter.rb
logster-0.8.1 lib/examples/sidekiq_logster_reporter.rb
logster-0.8.0 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.8 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.7 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.6 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.5 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.4 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.3 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.2 lib/examples/sidekiq_logster_reporter.rb
logster-0.1.1 lib/examples/sidekiq_logster_reporter.rb