JoshAshby / scubaru

few basic utils to help while deving rails projects

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scubaru

Scubaru is a set of utilities to help me with hacking on rails projects. Currently it has two parts:

  • A middleware that will set the log level to a different value for certain urls
  • An ActiveSupport::Notifications subscriber that pretty logs events on the notification bus.

Usage

Add this to your Gemfile

gem 'scubaru', git: 'https://github.com/JoshAshby/scubaru.git', require: 'scubaru'

Then you can either stick with the default behavior (which isn't that bad but also not recommended) or you can set up your own options in an initializer:

Subscriber options

# Use rails standard reverse domain notation for notifications
Scubaru::Subscriber.fqn_direction = :reverse

# Use redis style : delimiters for the ASN event name notation
Scubaru::Subscriber.delimiter = ':'

# Only blacklist notifications for railties
Scubaru::Subscriber.blacklist = [
  %r|railtie|
]

Middleware options

# change the log level to FATAL for urls in the blacklist
Scubaru::Middleware.log_level = Logger::FATAL

# make any GET request that starts with `/home` has its log level changed to `log_level`
Scubaru::Middleware.blacklist = [
  { pattern: $r|^/home|, method: :get }
]

About

few basic utils to help while deving rails projects

License:MIT License


Languages

Language:Ruby 79.4%Language:HTML 16.3%Language:CSS 2.3%Language:JavaScript 2.0%