def eliot_to_stdout(message_formats, action_formats, stdout=sys.stdout):
    """
    Write pretty versions of eliot log messages to stdout.
    """
    def eliot_output(message):
        message_type = message.get('message_type')
        action_type = message.get('action_type')
        action_status = message.get('action_status')

        message_format = ''
        if message_type is not None:
            if message_type == 'twisted:log' and message.get('error'):
                message_format = '%(message)s'
            else:
                message_format = message_formats.get(message_type, '')
        elif action_type is not None:
            if action_status == 'started':
                message_format = action_formats.get('action_type', '')
            # We don't consider other status, since we
            # have no meaningful messages to write.
        stdout.write(message_format % message)
        stdout.flush()

    add_destination(eliot_output)
dataset/ETHPy150Open ClusterHQ/flocker/flocker/common/script.py/eliot_to_stdout/original