From 31707a7dd4e8648a97e15f7b72d04fe087f128c8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Wed, 5 Feb 2014 12:46:35 +0100 Subject: [PATCH] Add --debug argument --- qutebrowser/app.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 25a59fc5a..283746fc0 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -52,6 +52,7 @@ class QuteBrowser(QApplication): self._parseopts() self._initlog() + self._initmisc() self.dirs = AppDirs('qutebrowser') if self.args.confdir is None: @@ -182,6 +183,8 @@ class QuteBrowser(QApplication): help='Set loglevel', default='info') parser.add_argument('-c', '--confdir', help='Set config directory ' '(empty for no config storage)') + parser.add_argument('-d', '--debug', help='Turn on debugging options.', + action='store_true') parser.add_argument('command', nargs='*', help='Commands to execute ' 'on startup.', metavar=':command') # URLs will actually be in command @@ -190,7 +193,7 @@ class QuteBrowser(QApplication): def _initlog(self): """Initialisation of the logging output.""" - loglevel = self.args.loglevel + loglevel = 'debug' if self.args.debug else self.args.loglevel numeric_level = getattr(logging, loglevel.upper(), None) if not isinstance(numeric_level, int): raise ValueError('Invalid log level: {}'.format(loglevel)) @@ -200,6 +203,11 @@ class QuteBrowser(QApplication): '[%(module)s:%(funcName)s:%(lineno)s] %(message)s', datefmt='%Y-%m-%d %H:%M:%S') + def _initmisc(self): + """Initialize misc things based on arguments.""" + if self.args.debug: + os.environ['QT_FATAL_WARNINGS'] = '1' + def _init_cmds(self): """Initialisation of the qutebrowser commands.