Socket
Book a DemoInstallSign in
Socket

concise_logging

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

concise_logging

bundlerRubygems
Version
1.1.0
Version published
Maintainers
1
Created
Source

ConciseLogging

Concise request logging for Rails production

screenshot

Logs a concise single line for each request at :warn level. This allows logging requests without all the extra logging that :info level outputs.

Not suitable for development but ideal for production settings where each request and associated parameters is logged.

Inspired by a blog post on RubyJunky.com.

Special thanks to Zohreh Jabbari for doing the initial coding and proof of concept.

Installation

Add this line to your application's Gemfile:

gem 'concise_logging'

And then execute:

$ bundle

Or install it yourself as:

$ gem install concise_logging

Usage

Add this to your config/production.rb. Configure tagging as per your desires. We use tagging to indicate application with a 2 letter code and environment with a single letter (e.g., p = production, s = staging).

# Configure logger to log warn and above
config.log_level = :warn
config.log_tags = ["cv-#{Rails.env[0]}"]
config.logger = ActiveSupport::TaggedLogging.new(ActiveSupport::Logger.new(File.join(Rails.root, "log", "#{Rails.env}.log")))

If you want to try the logger in development than you have to manually add the middleware and attach the log subscriber by adding these lines in your config/development.rb file. These lines are not needed for production.

Rails.application.middleware.use ConciseLogging::LogMiddleware
ConciseLogging::LogSubscriber.attach_to :action_controller

Contributing

  • Fork it ( https://github.com/[my-github-username]/concise_logging/fork )
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create a new Pull Request

FAQs

Package last updated on 15 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts