if s.strip(): # don't log empty stuff
# Under Qt, we log in "debug.log" in appdata. Moreover, when under cx_freeze, we have a
# problem because sys.stdout and sys.stderr are None, so we need to replace them with a
# wrapper that logs with the logging module.
if not op.exists(appdata):
# For basicConfig() to work, we have to be sure that no logging has taken place before this call.
- logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=l
+ logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=l,
format='%(asctime)s - %(levelname)s - %(message)s')
if sys.stderr is None: # happens under a cx_freeze environment
sys.stderr = SysWrapper()