Kaitlin Rupert wrote:
>>> def do_try():
>>> try:
>>> + log_param(options.debug)
>> log_param() is invoked here. It doesn't hurt to leave the invoke in
>> every test cases. But we don't have to add that in future test cases.
>>
> Excellent - do_try() just gets better in my book. ;)
>
> Would like to see some review comments on this patch. I have no
> complaints, but I'm interested in hearing whether people think this is
> useful.
>
> Thanks!
>
Ah.. my mistake.. I didn't notice this at first. Including log_param()
in both the test case itself and do_try() causes the messages to be
written to the log twice.
How about this:
def log_param(debug=None):
if debug == None:
return
else:
original log_param() body
This way, we don't have to worry about twice logging, and give us time
to remove the log_param() in the testcases.
And after all log_param() is removed from the testcases, we can revert
the log_param() to the state without a 'debug==None' check.
However, I like the idea of calling log_param() once in do_try() and not
having to worry about calling it in each test case.
--
- Zhengang