def log_to_file(log_path, log_urllib=False, limit=None):
log_path = log_path<EOL>file_handler = logging.FileHandler(log_path)<EOL>if limit:<EOL><INDENT>file_handler = RotatingFileHandler(<EOL>log_path,<EOL>mode='<STR_LIT:a>',<EOL>maxBytes=limit * <NUM_LIT> * <NUM_LIT>,<EOL>backupCount=<NUM_LIT:2>,<EOL>encoding=None,<EOL>delay=<NUM_LIT:0>)<EOL><DEDENT>fmt = '<STR_LIT>'<EOL>date_fmt = '<STR_LIT>'<EOL>formatter = logging.Formatter(fmt, datefmt=date_fmt)<EOL>file_handler.setFormatter(formatter)<EOL>logger.addHandler(file_handler)<EOL>if log_urllib:<EOL><INDENT>urllib_logger.addHandler(file_handler)<EOL>urllib_logger.setLevel(logging.DEBUG)<EOL><DEDENT>
Add file_handler to logger