def parse(self, logline):
        """
        Parse log line into structured row.
        Will raise ParseError Exception when
        parsing failed.
        """
        try:
            match = self.fieldselector.match(logline)
        except AttributeError, exc:
            raise AttributeError("%s needs a valid format string (--format)" % \
                    self.__class__.__name__ )

        if match:
            data = self._logline_wrapper
            data.clear()
            for k, v in zip(self.fieldnames, match.groups()):
                data[k] = v
            return data                
        else:
            raise ValueError("Could not parse log line: '%s'" % logline)
dataset/ETHPy150Open adamhadani/logtools/logtools/parsers.py/AccessLog.parse/original