Developers often have to look at log files. This is sometimes boring, sometimes tedious, but it's a fact of life. It would really help if some special lines, such as errors, warnings etc. could stand out. One way to do it is to use the clog utility.

To make clog usage more streamlined from a terminal, you can define this bash function:

# pipe a log file through clog to get colours
function logless
    if [ -z "$1" ]; then
        echo "No file given, exiting" 1>&2
        cat $1 | clog | less -R

Don't forget, you need to configure clog so that it is able to recognize the format of your log files, since there is no way it can know it in advance. If you happen to be using glog (Google log) library in its default configuration, try adding these settings to your .clogrc file:

default rule /^W/   --> yellow line
default rule /^E/   --> red line

Read clog manual for further information. Happy logging!

Tags: None
Categories: None |

0 comments have been posted.

Your email: we will send you a confirmation link to this address to confirm your identity and to prevent robot posting
Get in touch
Join notification list

Join the email list to get notified about new posts and other updates

Follow updates

Join our social networks and RSS feed to keep up to date with latest news and publications