Debug logging in modules

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
from ansible.callbacks import vv, vvv
File “/Users/m.joehren/matlockx/ansible/lib/ansible/callbacks.py”, line 18, in
import utils
File “/Users/m.joehren/matlockx/ansible/lib/ansible/utils/init.py”, line 29, in
from ansible.utils.display_functions import *
File “/Users/m.joehren/matlockx/ansible/lib/ansible/utils/display_functions.py”, line 22, in
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

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

“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.

But here’s also a blog post I wrote previously: http://michaeldehaan.net/post/35403909347/tips-on-using-debuggers-with-ansible

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!

Will do. Sorry for that. Missed it.