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-1.3.1 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.11 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.9 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.8 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.7 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.6 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.5 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.4 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.3 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.2 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.1 lib/examples/sidekiq_logster_reporter.rb
logster-1.2.0 lib/examples/sidekiq_logster_reporter.rb
logster-1.1.1 lib/examples/sidekiq_logster_reporter.rb
logster-1.0.1 lib/examples/sidekiq_logster_reporter.rb
logster-1.0.0.3.pre lib/examples/sidekiq_logster_reporter.rb
logster-1.0.0.2.pre lib/examples/sidekiq_logster_reporter.rb
logster-1.0.0.1.pre lib/examples/sidekiq_logster_reporter.rb
logster-1.0.0.0.pre lib/examples/sidekiq_logster_reporter.rb
logster-0.9.9 lib/examples/sidekiq_logster_reporter.rb
logster-0.8.4.8.pre lib/examples/sidekiq_logster_reporter.rb