Sha256: 387bd28eed1e2f947e19a64bbc6e4e27972e7e5c23054d67365d90c48e591f09
Contents?: true
Size: 1.87 KB
Versions: 1
Compression:
Stored size: 1.87 KB
Contents
# MongoRequestLogger Log requests in a structured format to MongoDB. ## Installation Add this line to your application's Gemfile: gem 'mongo_request_logger' And then execute: $ bundle Or install it yourself as: $ gem install mongo_request_logger ## Usage with Rails Create config/logger.yml containing something like the following: development: host: localhost database: your_app_logs_production_dev capsize: 100 production: host: localhost database: your_app_logs_production username: your_app_logs_production password: password capsize: 1024 Routes for log viewer mount MongoRequestLogger::Viewer, :at => "log" ## Usage with other Rack-based frameworks (Sinatra, etc) In config.ru, or where appropriate: require 'moped' config = { database: 'my_log_db', collection: 'log', capsize: 100 * 1024 * 1024, } adapter = MongoRequestLogger::Adapters::Moped.new(config) logger = MongoRequestLogger::Logger.new(adapter, "myapp.log") MongoRequestLogger::Rack.logger = loggger use MongoRequestLogger::Rack run MyApp ## Ignoring paths Often you want some requests not to be logged, for example assets files. This can be done by specifying the prefixes to be ignored: MongoRequestLogger::Rack.ignore_prefixes << '/assets/' ## Usage with resque Extend from MongoRequestLogger::LoggedJob, to have each job logged as if it was a request. class MyJob extend MongoRequestLogger::LoggedJob def perform(args) # ... end end ## License All code is under the MIT licence, see LICENSE.txt. ## Contributing 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mongo_request_logger-0.1.0 | README.md |