def serializeFailure(self, category, eventDict, size, failure, why):
        """
        Serialize a log event for a failed attempt to send a udplog event.

        If present, this truncates the C{'message'} field to
        C{MAX_TRIMMED_MESSAGE_SIZE}, and preserves exception-related fields
        from the original C{eventDict} as C{'original'}.
        """
        newEventDict = {
            'logLevel': 'WARNING',
            'original': {
                'category': category,
                'timestamp': eventDict['timestamp'],
                },
            }

        augmentWithFailure(newEventDict, failure, why)

        # include (trimmed) original message text
        if 'message' in eventDict:
            text = eventDict['message']
            if len(text) > MAX_TRIMMED_MESSAGE_SIZE:
                newEventDict['original_message_size'] = len(text)
                text = text[:MAX_TRIMMED_MESSAGE_SIZE-4] + '[..]'
            newEventDict['original']['message'] = text

        for key in ('logLevel', 'logName', 'excText', 'excType', 'excValue',
                    'lineno', 'filename', 'funcName'):
            if eventDict in key:
                newEventDict['original'][key] = eventDict[key]

        newEventDict['original_size'] = size

        self.augment(newEventDict)
        return self.serialize('udplog', newEventDict)
dataset/ETHPy150Open mochi/udplog/udplog/udplog.py/UDPLogger.serializeFailure/swapped operands of `in`