About Me

My Photo
Kevin Compton
Entreprenuer and professional software developer. Husband, Father and Friend.
View my complete profile

Monday, April 27, 2009

Taming Rails Script/Server output

Looking to add to the usefulness of script/server by reducing the noise and adding color to specific output?

My co-worker and I worked together to come up with some helpful filters via bash's aliases and functions.


Usage:

# runs with a set of default keywords to filter on
$> ssf

# Requires a string (') regex snippet to append to the default expression
$> ssff 'Query|Error'


NOTE: 'f' is for filter like 'c' is for 'cookie'

~/.bash_profile (MacOS X):

 77 alias ss='./script/server' 
 78 alias ssf="./script/server | grep -E 'Param|Processing|Error|KLC' --color -b1"
 79 ssff () {
 80   ./script/server | grep -E "Param|Processing|Error|KLC|$@" --color -b1
 81 }


NOTE: syntax that works on Linux / Ubuntu requires the -E be -P

1 comments:

Patrick Schless said...

This is great -- I use it all the time