Extract counters like nscanned and nreturned from the logevent.

def _extract_counters(self):
        """Extract counters like nscanned and nreturned from the logevent."""
        # extract counters (if present)
        counters = ['nscanned', 'nscannedObjects', 'ntoreturn', 'nreturned',
                    'ninserted', 'nupdated', 'ndeleted', 'r', 'w', 'numYields',
                    'planSummary', 'writeConflicts', 'keyUpdates']

        # TODO: refactor mtools to use current counter names throughout
        # Transitionary hack: mapping of current names into prior equivalents
        counter_equiv = {
            'docsExamined': 'nscannedObjects',
            'keysExamined': 'nscanned',
            'nDeleted': 'ndeleted',
            'nInserted': 'ninserted',
            'nMatched': 'nreturned',
            'nModified': 'nupdated'
        }
        counters.extend(counter_equiv.keys())

        split_tokens = self.split_tokens

        # trigger operation evaluation to get access to offset
        if self.operation:
            for t, token in enumerate(split_tokens[self.datetime_nextpos +
                                                   2:]):
                for counter in counters:
                    if token.startswith('%s:' % counter):
                        try:
                            # Remap counter to standard name, if applicable
                            counter = counter_equiv.get(counter, counter)
                            vars(self)['_' + counter] = int((token.split(':')
                                                             [-1]).replace(',',
                                                                           ''))
                        except ValueError:
                            # see if this is a pre-2.5.2 numYields with space
                            # in between (e.g. "numYields: 2")
                            # https://jira.mongodb.org/browse/SERVER-10101
                            if (counter == 'numYields' and
                                    token.startswith('numYields')):
                                try:
                                    self._numYields = int((split_tokens[t + 1 + self.datetime_nextpos + 2]).replace(',', ''))
                                except ValueError:
                                    pass
                            if (counter == 'planSummary' and
                                    token.startswith('planSummary')):
                                try:
                                    self._planSummary = split_tokens[t + 1 + self.datetime_nextpos + 2]
                                    if self._planSummary:
                                        if split_tokens[t + 1 + self.datetime_nextpos + 3] != '{':
                                            self._actualPlanSummary = self._planSummary
                                        else:
                                            self._actualPlanSummary = '%s %s' % (
                                                self._planSummary,
                                                self._find_pattern('planSummary: %s' % self._planSummary, actual=True)
                                            )
                                except ValueError:
                                    pass

                        # token not parsable, skip
                        break