public
Rubygem
Description: log_buddy is your friendly little log buddy by your side
Homepage: http://opensource.thinkrelevance.com/wiki/log_buddy
Clone URL: git://github.com/relevance/logbuddy.git
Search Repo:
name age message
folder .gitignore Tue Jul 01 04:52:09 -0700 2008 ignore pkg [rsanheim]
folder CHANGELOG Fri Jul 04 20:28:55 -0700 2008 version 0.0.5 - update to use echoe that works ... [rsanheim]
folder LICENSE Fri Apr 11 08:16:40 -0700 2008 add seperate license [rsanheim]
folder Manifest Tue Jul 01 04:55:02 -0700 2008 update manifest for removing log buddy [rsanheim]
folder README.rdoc Sat Jul 19 11:47:56 -0700 2008 whitespace [rsanheim]
folder Rakefile Fri Jul 04 20:28:55 -0700 2008 version 0.0.5 - update to use echoe that works ... [rsanheim]
folder examples.rb Thu Jul 10 19:53:27 -0700 2008 another example [rsanheim]
folder init.rb Fri Apr 04 06:26:53 -0700 2008 initial commit [rsanheim]
folder lib/ Fri Jul 04 20:28:55 -0700 2008 version 0.0.5 - update to use echoe that works ... [rsanheim]
folder log_buddy.gemspec Fri Jul 04 20:29:21 -0700 2008 update gemspec [rsanheim]
folder test/ Fri Apr 04 10:47:14 -0700 2008 reorg a bit and add docs [rsanheim]
README.rdoc

LogBuddy

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". You can use your own logger with Logbuddy by passing it into init’s options hash:

    LogBuddy.init :default_logger => Logger.new('my_log.log')

Now you have your logger available from any object, at the instance level and class level:

    obj = Object.new
    obj.logger.debug("hi")
    class MyClass; end
    MyClass.logger.info("heya")

You also have a method called "d" (for "debug") on any object, which is used for quick debugging and logging of things while you are developing. Its especially useful while using autotest. When you call the "d" method with an inline block, it will log the name of the things in the block and the result. Examples:

    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!"

See examples.rb for live examples you can run.

REQUIREMENTS:

  • Ruby 1.8.6 or JRuby (tested with 1.1RC3)
  • untested on Ruby < 1.8.6, but probably works

ISSUES

  • 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

URLS

  • Log bugs, issues, and suggestions on Trac: http://opensource.thinkrelevance.com/wiki/log_buddy
  • View Source: http://github.com/relevance/logbuddy/tree/master
  • Git clone Source: git://github.com/relevance/logbuddy.git
  • RDocs: http://thinkrelevance.rubyforge.org/log_buddy/

LICENSE:

(The MIT License)

Copyright © 2008 Relevance, Inc. - http://thinkrelevance.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.