def setIndex(self, col, field, **kwargs): try: ensureIndex(col, field, **kwargs) self.logger.info("Success to create index %s on %s" % (field, col)) except Exception as e: self.logger.error("Failed to create index %s on %s: %s" % (col, field, e))
def setIndex(self, col, field, printSuccess=True): try: ensureIndex(col, field) if printSuccess: self.logger.info("Success to create index %s on %s" % (field, col)) except Exception as e: self.logger.error("Failed to create index %s on %s: %s" % (col, field, e))