log_buddy is your friendly log buddy aiding your development in times of need.

log_buddy

DESCRIPTION

log_buddy is your friendly little log buddy at your side, helping you dev, debug, and test.

SYNOPSIS

Call LogBuddy.init to use log_buddy. It will add two methods to object instance and class level: "d" and "logger".

  • The "logger" method is just a typical logger - it will use the Rails logger if its available.
  • The "d" method is a special helper that will output the code in the block and its result - note that you *must* use the bracket block form - do...end is not supported.

EXAMPLES

See also examples.rb...

a = "foo"
@a = "my var"
@@bar = "class var!"
def bark
 "woof!"
end

d { a }      # logs "a = 'foo'"
d { @a }     # logs "@a = 'my var'"
d { @@bar }  # logs "@@bar = 'class var!'"
d { bark }   # logs "bark = woof!"

REQUIREMENTS

  • Ruby 1.8.6 or JRuby (tested with 1.1RC3)

ISSUES

  • Be careful you don't depend on methods that log_buddy adds to Object in production!
  • This is meant for non-production use while developing and testing --> it does stuff that is slow and you probably don't want happening in your production environment.
  • Don't even try using this in irb.

INSTALL

sudo gem install log_buddy