What does ColorTail do for me?
ColorTail provides a cool way for you to configure how logfiles (or any other files for that matter) look when you tail them.
gem install colortail
By default, ColorTail does absolutely nothing other than just tail a file normally (similar to the trust old unix tool 'tail -f'). But what good what writing a gem be if it just mimiced existing functionality.
Configuring ColorTail is easy. In your home directory, create a file .colortailrc. This file will contain a group of ruby arrays similar to the ones laid out in the example config examples/colortail.rb. These arrays are called groups. Any group can be loaded via the command line using the -g switch (more on this below).
The standard configuration file is .colortailrc. It needs to be in the format of a Ruby hash.
The full list of choices for colors and combinations are listed below.
- none - Yes you can have no color. This means display normally.
- black
- red
- green
- yellow
- blue
- magenta - (purple-ish)
- cyan
- light gray
- bright
- dim
- underscore
- blink
- reverse
- hidden - simply don't show the text
To get the additional colorset listed below, use the bright attribute.
- dark gray (bright black)
- light blue (bright blue)
- light green (bright green)
- light cyan (bright cyan)
- light red (bright red)
- light purple (bright purle)
- yellow (bright brown)
- white (bright light gray)
The example given in the configuration file is good for tailing a syslog file that has lines that are naemd with their syslog level. There are a lot of potential uses.
Using ColorTail is similar to using tail. The main assumption is that you will always be indefinitely tail'ing a file.
The command below will tail the /var/log/messages file using the syslog group. The example config examples/colortail.rb shows a syslog grouping that is used in command below (the below 2 commands are equivilent):
To tail multiple files can be confusing, especially when you don't know which file you are seeing. Use the -F option to show the filenames at the beginning of each colored line.
You can also tail multiple files using different color groups. Currently, the separater is #. If no grouping is specified with the file or the grouping specified doesn't exist, colortail will default to the one specied on the command line.
ColorTail intentionally does not die when a file specified on the command line doesn't exist.
- Homepage: https://github.com/elubow/colortail
Eric Lubow <eric at lubow dot org>
- Web: http://eric.lubow.org/
- Twitter: elubow
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
Copyright (c) 2010 Eric Lubow. See LICENSE for details.