jpcamara / emoji_log

Visually scan your rails controller logs using the power of emojis 🐒 πŸ‡ πŸš€

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EmojiLog

A LogSubscriber for Rails that modifies controller logs with emojis to represent performance (🐒, πŸ‡, πŸš€) and http status codes (🧠, βœ…, πŸ”, ❌, πŸ”₯, ❓).

Inspired by an episode of the Syntax podcast.

I wrote this really nice little handy middleware... that analyzes all my requests as they go, just timing them - and based on how long the request takes it gives me different emoji. So if the request is really fast it's a πŸš€, if it's kinda fast it's a πŸ‡, if it's slow it's a 🐒. ...In my console while I'm just browsing the site I can just see - and it has what type of request, what path it was too, and it's just like at a glance I can see - 'oh I'm in turtle time right now - these requests to this page are all slow for some reason let me take a look'

Scott Tolinski Syntax Podcast, Episode 570 - https://syntax.fm/show/570/node-js-cjs-esm

Usage

config.after_initialize do
  EmojiLog.slow = "🐒"
  EmojiLog.average = "πŸ‡"
  EmojiLog.fast = "πŸš€"
  EmojiLog.slow_threshold = 1000
  EmojiLog.average_threshold = 500
  EmojiLog.fast_threshold = 150

  EmojiLog.info = "🧠"
  EmojiLog.success = "βœ…"
  EmojiLog.redirect = "πŸ”"
  EmojiLog.bad = "❌"
  EmojiLog.error = "πŸ”₯"
  EmojiLog.cancelled = "❓"
end

Installation

Add this line to your application's Gemfile:

gem "emoji_log"

And then execute:

$ bundle

Or install it yourself as:

$ gem install emoji_log

License

The gem is available as open source under the terms of the MIT License.

About

Visually scan your rails controller logs using the power of emojis 🐒 πŸ‡ πŸš€

License:MIT License


Languages

Language:Ruby 78.7%Language:HTML 16.8%Language:JavaScript 2.4%Language:CSS 2.2%