nmcontrol
nmcontrol copied to clipboard
Standard logging module
The current logging system is pretty inflexible, it doesn't show timestamps, only supports two verbosity levels, and doesn't directly support logging to a file. Python has a standard logging module, has anyone used it before?
+1 http://pastebin.com/k6kHWfrJ
I am very happy with this logging configuration: https://github.com/phelix/nameGUI/blob/master/lib/mylogging.py It would also get rid of all 'print' statements, improving py3 compatibility.
Suggested procedure:
- use
2to3 -f print
to replaceprint "foo"
byprint("foo")
everywhere - replace
print
bylog.info
; implement logging creation function in "common" - (optional:) remove
if debug
statements and replacelog.info
bylog.debug
in these places; also set log level in main module