code: function analyzeLine(line, rules) {
      var result = {
          line: line
      };
      rules.rules.forEach(function (rule) {
          if (rule.re.test(line)) {
              line = line.replace(rule.re, rule.replace);
              if (rule.emitLevel) {
                  if (result.emitLevel) {
                      result.emitLevel = Math.min(result.emitLevel, rule.emitLevel);
                  }
                  else {
                      result.emitLevel = rule.emitLevel;
                  }
              }
          }
      });
      if (!result.emitLevel) {
          result.emitLevel = rules.defaultEmitLevel || 5;
      }
      result.colored = line;
      return result;
  }
docs: Replace color codes in str with real curses colors.
  @returns object with following attributes:
  colored: the line with color marker e.g. #{c_cyan}
  line: the original line coming from the input stream
  emitLevel: the minimal level (1=very import, 9=very verbose)