def emit()

in ansible/callbacks/logformatter.py [0:0]


    def emit(self, host, category, data):
        """Emit colorized output based upon data contents."""
        if type(data) == dict:
            cmd = data['cmd'] if 'cmd' in data else None
            msg = data['msg'] if 'msg' in data else None
            stdout = data['stdout'] if 'stdout' in data else None
            stderr = data['stderr'] if 'stderr' in data else None
            reason = data['reason'] if 'reason' in data else None

            print()
            if cmd:
                print(hilite('[%s]\n> %s' % (category, cmd), category, wrap = False))
            if reason:
                print(hilite(reason, category))
            if msg:
                print(hilite(msg, category))
            if stdout:
                print(hilite(stdout, category))
            if stderr:
                print(hilite(stderr, category))