Skip to content

armandmgt/lograge_active_job

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Lograge extensions for Rails

Rails middleware for Lograge with support to log exceptions ActiveJobs.

Logs:

  • Exceptions occurred during running jobs on ActiveJob (Rails 4.2+)

Installation

Add line to your application's Gemfile:

gem 'rails' # minimal version is 4.0
gem 'lograge'
gem 'lograge_active_job'

Now, gem should catch all exceptions thrown by ActiveJobs and save them to Lograge.

Please remember about Lograge configuration.

Custom setup

You can configure additional fields, which will be logged for every exception.

# config/initializers/lograge.rb
Rails.configure do |config|
  config.rails_lograge_middleware.custom_options = lambda do |exception, job|
    # == Parameters:
    # exception:
    #   Occurred exception
    # job:
    #   ActiveJob instance, which crashed
    #
    # == Returns:
    # Hash with elements to write to log
    #
    {
	# Your custom options
    }
  end
end

References:

Rack::Request

About

Rails middleware for Lograge with support to log exceptions from Rails and ActiveJobs.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%