<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def emit(self, record):
 """Persist a record into the database Args: record (`logging.Record`):
 The logging.Record object to store Returns: `None` """

        # Skip records less than min_level
        if record.levelno < logging.getLevelName(self.min_level):
            return

        evt = LogEvent()
        evt.level = record.levelname
        evt.levelno = record.levelno
        evt.timestamp = datetime.fromtimestamp(record.created)
        evt.message = record.message
        evt.filename = record.filename
        evt.lineno = record.lineno
        evt.module = record.module
        evt.funcname = record.funcName
        evt.pathname = record.pathname
        evt.process_id = record.process

        # Only log stacktraces if its the level is ERROR or higher
        if record.levelno >= 40:
            evt.stacktrace = traceback.format_exc()

        try:
            db.session.add(evt)
            db.session.commit()
        except Exception:
            db.session.rollback()