Open `filename` and start processing it line by line. If `filename` is
    none, process lines from `stdin`.

def main(filename):
    """
    Open `filename` and start processing it line by line. If `filename` is
    none, process lines from `stdin`.
    """
    if filename:
        if not os.path.exists(filename):
            logger.error("'%s' doesn't exists!" % filename)
            sys.stderr.write("'%s' doesn't exists!\n" % filename)
            sys.exit(1)

        logger.info("Processing '%s'" % filename)
        for ir in process_log(sh.tail("-f", filename, _iter=True)):
            print ir
    else:
        logger.info("Processing stdin.")
        for ir in process_log(_read_stdin()):
            print ir