0001
0002
0003
0004
0005
0006
0007
0008'''common configuration settings.
0009
0010'''
0011import sys
0012
0013class debug:
0014 """namespace for debug settings."""
0015 stream = None
0016_last_debug_stream = debug.stream
0017
0018def reset_debug(strm=_last_debug_stream):
0019 """resets debug stream to the last stream -OR- kwarg strm.
0020
0021 when strm is None, this turns off debugging
0022
0023 """
0024 return set_debug_stream(strm)
0025
0026def set_debug_stream(strm):
0027 """tells debug print statements to use strm.
0028
0029 returns last stream.
0030
0031 """
0032 global _last_debug_stream
0033 _last_debug_stream = debug.stream
0034
0035 debug.stream = strm
0036 return _last_debug_stream
0037
0038def set_debug_stderr():
0039 """convenience method for set_debug_stream(sys.stderr)."""
0040 return set_debug_stream(sys.stderr)
0041
0042def set_debug_stdout():
0043 """convenience method for set_debug_stream(sys.stdout)."""
0044 return set_debug_stream(sys.stdout)