Debug logging in modules

93 views
Skip to first unread message

Martin Jöhren

unread,
May 25, 2014, 2:14:51 AM5/25/14
to ansible...@googlegroups.com
Hi,

after some searching I did not find anything appropriate: I just want to log some debug information in my on new module in libraries/cloud, so my first attempt was to use vv, but when I import it

from ansible.callbacks import vv, vvv

it's always complaining about 

Traceback (most recent call last):
  File "/Users/m.joehren/.ansible_module_generated", line 72, in <module>
    from ansible.callbacks import vv, vvv
  File "/Users/m.joehren/matlockx/ansible/lib/ansible/callbacks.py", line 18, in <module>
    import utils
  File "/Users/m.joehren/matlockx/ansible/lib/ansible/utils/__init__.py", line 29, in <module>
    from ansible.utils.display_functions import *
  File "/Users/m.joehren/matlockx/ansible/lib/ansible/utils/display_functions.py", line 22, in <module>
    from ansible.callbacks import display
ImportError: cannot import name display

Is it a python thing that i'm missing here (i'm more or less python beginner)?
Anyhow, how should debug logging in modules be done? And when I use vv, how can I pass that to the test-module command on the command line?

Thanks in advance,

Martin


Martin Jöhren

unread,
May 25, 2014, 7:49:02 AM5/25/14
to ansible...@googlegroups.com

K, found the import issue. Just had to add it by myself in my module.
I'm still interested in getting to know whether it is the preferred way to log debug information and how to use it when running test_module.

Thx

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/6KNvOD-yvHk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/fa7a1c56-a7fd-49bd-8219-833e3462416a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Michael DeHaan

unread,
May 25, 2014, 5:07:42 PM5/25/14
to ansible...@googlegroups.com
"I'm still interested in getting to know whether it is the preferred way to log debug information and how to use it when running test_module."

I do a fair amount of print output actually.


FWIW, I'd suggest you join ansible-devel for development topics, trying to get that one a bit more active and this is probably a bit involved for ansible-project.

Thanks!



--
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 ansible-proje...@googlegroups.com.

To post to this group, send email to ansible...@googlegroups.com.

Martin Jöhren

unread,
May 25, 2014, 5:09:10 PM5/25/14
to ansible...@googlegroups.com
Will do. Sorry for that. Missed it.

On 25.05.2014, at 23:07, Michael DeHaan <mic...@ansible.com> wrote:

FWIW

Reply all
Reply to author
Forward
0 new messages