def main(filename):
if filename:<EOL><INDENT>if not os.path.exists(filename):<EOL><INDENT>logger.error("<STR_LIT>" % filename)<EOL>sys.stderr.write("<STR_LIT>" % filename)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>logger.info("<STR_LIT>" % filename)<EOL>for ir in process_log(sh.tail("<STR_LIT>", filename, _iter=True)):<EOL><INDENT>print(ir)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>logger.info("<STR_LIT>")<EOL>for ir in process_log(_read_stdin()):<EOL><INDENT>print(ir)<EOL><DEDENT><DEDENT>
Open `filename` and start processing it line by line. If `filename` is
none, process lines from `stdin`.