Part of TrackerHub, Request is a gem tracking every requests on the backend side. Some keys will be filtered and the request data will finally be saved into a logfile. This logfile will be automatically managed and rotated by the logging gem.
Add this line to your application's Gemfile:
And then execute:
In an initializer, you can configure the tracker:
# ./config/initializers/request_tracker.rb TrackerHub::Request.setup do |config| config.app_version = '1.0' config.required_keys = %w(my rack env keys to log) config.logger = ActiveSupport::Logger.new('requests.log') config.notification = TrackerHub::Request::Notification.new(TrackerHub::Request::Notification::HipChat.new('my_token', 'my_room', 'my_username')) end
Here you can define your own configured logger. The default logger is logging. Feel free to add your own, or use another gem!
If an error occure, it will be catched and a notification will be sent to the service of your choice. The list of available services are defined here.
Add the middleware to your environment:
config.middleware.insert_after ActionDispatch::DebugExceptions, TrackerHub::Request::Middleware
Activate the TrackerHub by adding to your environment (or
Get your request logs:
$ tail -f ./log/tracker/requests.log
To run tests:
$ bundle exec rake spec
Bug reports and pull request are welcome on GitHub at https://github.com/SparkHub/gs-tracking-requests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.