Write record as journal event.

        MESSAGE is taken from the message provided by the
        user, and PRIORITY, LOGGER, THREAD_NAME,
        CODE_{FILE,LINE,FUNC} fields are appended
        automatically. In addition, record.MESSAGE_ID will be
        used if present.

def emit(self, record):
        """Write record as journal event.

        MESSAGE is taken from the message provided by the
        user, and PRIORITY, LOGGER, THREAD_NAME,
        CODE_{FILE,LINE,FUNC} fields are appended
        automatically. In addition, record.MESSAGE_ID will be
        used if present.
        """
        if record.args and isinstance(record.args, collections.Mapping):
            extra = dict(self._extra, **record.args)  # Merge metadata from handler and record
        else:
            extra = self._extra
        try:
            msg = self.format(record)
            pri = self.mapPriority(record.levelno)
            mid = getattr(record, 'MESSAGE_ID', None)
            send(msg,
                 SOCKET=self.socket,
                 MESSAGE_ID=mid,
                 PRIORITY=format(pri),
                 LOGGER=record.name,
                 THREAD_NAME=record.threadName,
                 CODE_FILE=record.pathname,
                 CODE_LINE=record.lineno,
                 CODE_FUNC=record.funcName,
                 **extra)
        except Exception:
            self.handleError(record)