import logging
import re


def grep_file(query, item):
    """
    args:
        query: a string
        item: a file path
    returns:
        a list containing a line for every line in the file
        containing the query
    """
    results = []
    logging.info("grepping file: {0}".format(item))
    for index, line in enumerate(open(item)):
        if re.search("{0}".format(query), line):
            results.append('{0}:{1} {2}'.format(item, index + 1, line))
    return results