<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>For Neutron, I'm creating a module (one of several eventually) as part of a new blueprint I'm working on, and the associated unit test module. I'm in really early development, and just running this UT module as a standalone script (rather than through tox). It allows me to do TDD pretty quickly on the code I'm developing (that's the approach I'm taking right now - fingers crossed :).</div><div><br></div><div>In the module, I did an import of the <b>logging</b> package and when I run UTs I can see messaging that would occur, if desired.</div><div><br></div><div>I have the following hack to turn off/on the logging for debug level:</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(203, 203, 203); "><span style="color: #0433ff">if</span><span style="color: #000000"> </span><span style="color: #0433ff">False</span><span style="color: #000000">:  </span># Debugging</div><div style="margin: 0px; font-size: 11px; font-family: Monaco; color: rgb(0, 180, 0); "><span style="color: #000000">    logging.basicConfig(format=</span>'%(asctime)-15s [%(levelname)s] %(message)s'<span style="color: #000000">,</span></div><div style="margin: 0px; font-size: 11px; font-family: Monaco; ">                        level=logging.DEBUG)</div></div><div><br></div><div>I made the log calls the same as what would be in other Neutron code, so that I don't have to change the code later, as I start to fold it into the Neutron code. However, I'd like to import the <b>neutron.openstack.common.log</b> package in my code, so that the code will be identical to what is needed once I start running this code as part of a process, but I had some questions…</div><div><br></div><div>When using neutron.openstack.common.log, how do I toggle the debug level logging on, if I run this standalone, as I'm doing now?</div><div>Is there a way to do it, without adding in the above conditional logic to the production code? Maybe put something in the UT module?</div><div><br></div><div>I can always continue as is, and then switch things over later (changing the import line and pulling the if clause), once I have things mostly done, and want to run as part of Neutron, but it would be nice if I can find a way to do that up front to avoid changes later.</div><div><br></div><div>Thoughts? Suggestions?</div><div><br></div><div>Thanks!</div><div><br></div><div><br><div apple-content-edited="true">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>PCM (Paul Michali)</div><div><br></div><div>MAIL          <a href="mailto:pcm@cisco.com">pcm@cisco.com</a></div><div>IRC            pcm_  (<a href="http://irc.freenode.net">irc.freenode.net</a>)</div><div>TW            @pmichali</div><div>GPG key    4525ECC253E31A83</div><div>Fingerprint 307A 96BB 1A4C D2C7 931D 8D2D 4525 ECC2 53E3 1A83</div></div></span>
</div>

<br></div></body></html>