Stump

Code Climate Build Status Dependency Status Gem Version

Stump is a minimal wrapper around the basic ruby logger that provides logging to a log file in addition to STDOUT - something which is for some reason rather hard to do for rack-based applications not using Rails. It also provides an access_log which you can write to STDOUT and (if you wish) a log file.

Why call it Stump? It's like a small (tree) log, get it? Get it?

Usage

# Gemfile
gem 'stump'

# configuration file for your rack-based application
require 'stump'

logger = Stump::Logger.new
use Stump::AccessLog, logger

Example

The following example demonstrates usage of stumpin a vanilla, minimal sinatra application. You can literally copy this code and run the example in less than a minute.

# Gemfile
source 'https://rubygems.org'

gem 'sinatra'
gem 'stump'

# hi.rb
require 'sinatra'
require 'stump'

logger = Stump::Logger.new "tmp/log.log"
logger.level = Logger::DEBUG
use Stump::AccessLog, logger

get '/hi' do
  logger.debug 'hello'
  'What came first - the cat or the internet?'
end

Run bundle and ruby hi.rb, point your brower to localhost:4567/hi and witness the magic.

Issues

"Hey, it's not working!"

This can totally happen, so just open up an issue and I'll get right on it!

License

Copyright (c) @nicovhi, released under the MIT License.