13

I am looking for a solution that would allow me to use color highlighting to a set of important output messages inside iTerm terminal application.

Things to highlight:

  • application logs file warnings, errors and fatals (apache, nginx, tomcat)
  • compiler output
  • other similar errors/warnings

enter image description here

  • 1
    what exactly is your question here? If it's the question in the title, what do you mean with "optimal"? – nohillside Sep 4 '12 at 13:15
  • Hmm - let me see if I can help - you have some of the answer in the question. As edited, it's still a bit too much in the category of "•every answer is equally valid: “What’s your favorite ______?” •your answer is provided along with the question, and you expect more answers: “I use ______ for ______, what do you use?” – bmike Sep 4 '12 at 13:46
35

iTerm supports coloring of console output based on a set of regular expressions. You can set them up in Preferences > Profiles > Advanced > Triggers > Edit.

Here is my current set of regexes:

(?i:.*error.*)                     // Yellow on Black
(?i:.*(warning|warn).*)            // Orange on Black
(?i:.*FATAL.*)                     // White on Red

iTerm regexes in a profile’s Triggers

You are welcome to improve it :)

  • Any idea what version of iTerm this was introduced? I can't find this option in Build 0.10 – Sridhar Sarnobat Oct 29 '15 at 20:15
  • I've added this (\s\sat.*) To catch any Exception traces such as at /Users/rootux/.nvm/versions/node/v8.1.2/lib/node_modules/truffle/build/cli.bundled.js:329530:36 – Gal Bracha Feb 7 '18 at 15:13
  • I have added ( |\[|\(|"|') to the patter, so the error above would be (?i:.*( |\[|\(|"|')error( |\]|\)|"|')).*). With this the logs like [246] ./components/src/errors/accessDeniedError.ts 366 bytes {0} [built] are not highlighted – RoberMP Apr 5 '18 at 9:45
  • Sorry there is a mistake above but not longer able to edit (moderator?). It should be (?i:.*( |\[|\(|"|')error( |\]|\)|"|').*) – RoberMP Apr 5 '18 at 9:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .