Commits

Virgil Dupras committed d894954

Added a level argument to util.setupQtLogging().

Comments (0)

Files changed (1)

         if s.strip(): # don't log empty stuff
             logging.warning(s)
 
-def setupQtLogging():
+def setupQtLogging(level=logging.WARNING):
     # 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):
         os.makedirs(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=logging.WARNING,
+    logging.basicConfig(filename=op.join(appdata, 'debug.log'), level=level,
         format='%(asctime)s - %(levelname)s - %(message)s')
     if sys.stderr is None: # happens under a cx_freeze environment
         sys.stderr = SysWrapper()