Giter Club home page Giter Club logo

logster's Introduction

logster logo

Logster is an embedded Ruby "exception reporting service" admins can view on live websites, at http://example.com/logs

Interface

Screenshot

Play with a live demo at logster.info/logs.

Installation

Add these lines to your application's Gemfile:

gem 'redis'
gem 'logster'

And then execute:

$ bundle

Make logster web available add the following to your routes.rb:

constraints lambda { |req| req.session["admin"] } do
  mount Logster::Web => "/logs"
end

By default, logster will only run in development and production environments.

To run logster in other environments, in config/application.rb

Logster.set_environments([:development, :staging, :production])

Tracking Error Rate

Logster allows you to register a callback when the rate of errors has exceeded a given limit.

Tracking buckets available are one minute and an hour.

Example:

Logster.register_rate_limit_per_minute(Logger::WARN, 60) do |rate|
  puts "O no! The error rate is now #{rate} errors/min"
end

Logster.register_rate_limit_per_hour([Logger::WARN, Logger::ERROR, Logger::FATAL], 60) do |rate|
  puts "O no! The error rate is now #{rate} errors/hour"
end

Note

If you are seeing the error No such middleware to insert before: ActionDispatch::DebugExceptions after installing logster, then you are using a conflicting gem like better_errors or web-console.

To avoid this error, make sure logster is added behind those conflicting gems in your Gemfile.

Mount using warden (devise)

  admin_constraint = lambda do |request|
    request.env['warden'].authenticate? and request.env['warden'].user.admin?
  end

  constraints admin_constraint do
    mount Logster::Web, at: "/logs"
  end

Out of the box, logster will use the default redis connection, to customise, in config/application.rb

Logster.store = Logster::RedisStore.new(redis_connection)

Heroku Deployment

In case you may be using the rails_12factor gem in a production deployment on Heroku, the standard Rails.logger will not cooperate properly with Logster. Extend Rails.logger in your config/application.rb or config/initializers/logster.rb with:

if Rails.env.production?
    Rails.logger.extend(ActiveSupport::Logger.broadcast(Logster.logger))
end

Thanks

Logster UI is built using Ember.js

Contributing

  1. Fork it ( https://github.com/discourse/logster/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Run cd client-app && npm install
  4. Run rake client_dev to start Sinatra server (port 9292) and Ember server (port 4200). Use Ember server for hot reload for client code.
  5. Once you're done making changes, run ./build_client_app.sh to make and copy a production build to the assets folder. (Shutting down the rake task will do this step automatically for you)
  6. Commit your changes (git commit -am 'Add some feature')
  7. Push to the branch (git push origin my-new-feature)
  8. Create a new Pull Request

logster's People

Contributors

samsaffron avatar tgxworld avatar riking avatar coding-horror avatar osamasayegh avatar jiajiawang avatar xrav3nz avatar supermathie avatar aaronlasseigne avatar benubois avatar koss-lebedev avatar zogstrip avatar bf4 avatar nbianca avatar bbonamin avatar bitsapien avatar majakomel avatar lumenlunae avatar neutralangel avatar eviltrout avatar

Watchers

James Cloos avatar Muhammad Yana Mulyana avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.