Hi

Thanks very much for this. Its just what I'm looking for.

I wonder however, might it contain a small bug? stdout and stderr are both 
being output in yellow always rather than stderr being output in bright red 
which is preferable. I think that the following fixes this:

def display_output(output, color='yellow'):
    if output:
        output = "\n    ".join(output.split("\n"))
        print(stringc("    " + output, color))


Best regards

chris


On Saturday, 25 July 2015 22:33:14 UTC+1, Dave Thomas wrote:
>
> I took Cliffano Subagio's "human_logging" gist and made the output a lot 
> more compact—I think it's easier to read:
>
> https://gist.github.com/pragdave/4b984557676d2d6c92a6
>
> # Interpret the Ansible log for humans. In particular, we
> # look for command executions and format their content
> #
> #     - name: list files
> #       shell: "ls -lrt *e*"
> #
> # Might produce
> #
> #       TASK: [1] 
> ***********************************************************
> #       changed: [localhost]
> #       2015-07-25 09:41:03: ls -lrt *e*
> #           -rw-r--r--  1 dave  staff  1696 Jul 11 11:54 ansible.pem
> #           -rw-r--r--  1 dave  staff   106 Jul 22 10:10 fix-sudoers.sh
> #           -rw-r--r--  1 dave  staff    20 Jul 22 20:06 fred.yml
> #           -rw-r--r--  1 dave  staff   345 Jul 23 14:48 ansible.cfg
> #           -rw-r--r--  1 dave  staff    68 Jul 25 09:35 site.yml
> #
> #           filter_plugins:
> #           total 16
> #           -rw-r--r--  1 dave  staff  247 Jul 24 18:06 to_instance_tags.py
> #           -rw-r--r--  1 dave  staff  859 Jul 24 20:55 
> to_instance_tags.pyc
> #           (took .008240s)
> #
> # The start time appears as the prompt for the command, and the result
> # is shown indented. The output ends with the elapsed time.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c3085e2c-e0a9-472a-9169-a3cd5abf0d19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to