Skip to content

trogdoro/spit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

Spit variables out to your log in a noticeable color. It adds a sensible label automatically.

Usage Examples

You use it by doing something like this:

Spit account

And it puts something like this in the log output (but with color):

account: <#Account @name="Steve">

To show the source of the line (filename, method, and line number) do something like this:

Spit.s account

And it puts something like this in the log output (but with color):

foo_controller.index(38) account: <#Account @name="Steve">

The Point

So you don’t have to keep typing things like this over and over while developing / debugging:

print "foo: #{foo}"

It’s intended to make it easier during development to print out values of variables and have them stand out in the log… pretty simple concept. There might be something out there like it - I didn’t look around very much.

How it works

The only tricky thing about spit is how it creates the label. Under the covers it uses caller() to get the file and line, and then goes and grabs the label from the actual source file. This isn’t super-efficient, but will likely be almost intstantaneous unless you print out a rather large number of variables at once.

Future plans

Support for multiple variables, like: Spit(account, user)

Support for choosing a color, like: Spit.red account

Copyright © 2011 trogdoro. See LICENSE.txt for further details.

About

Print vars to your rails console with colors and labels.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages