def _init_crashlogfile(self): """Start a new logfile and redirect faulthandler to it.""" logname = os.path.join(standarddir.data(), 'crash.log') try: self._crash_log_file = open(logname, 'w', encoding='ascii') except OSError: log.init.exception("Error while opening crash log file!") else: earlyinit.init_faulthandler(self._crash_log_file)
def _init_crashlogfile(self): """Start a new logfile and redirect faulthandler to it.""" path = standarddir.get(QStandardPaths.DataLocation) logname = os.path.join(path, 'crash.log') try: self._crashlogfile = open(logname, 'w', encoding='ascii') except OSError: log.init.exception("Error while opening crash log file!") else: earlyinit.init_faulthandler(self._crashlogfile)
def _init_crashlogfile(self): """Start a new logfile and redirect faulthandler to it.""" assert not self._args.no_err_windows data_dir = standarddir.data() if data_dir is None: return logname = os.path.join(data_dir, 'crash.log') try: self._crash_log_file = open(logname, 'w', encoding='ascii') except OSError: log.init.exception("Error while opening crash log file!") else: earlyinit.init_faulthandler(self._crash_log_file)
def _init_crashlogfile(self): """Start a new logfile and redirect faulthandler to it.""" assert not self._args.no_err_windows data_dir = standarddir.data() if data_dir is None: return logname = os.path.join(data_dir, "crash.log") try: self._crash_log_file = open(logname, "w", encoding="ascii") except OSError: log.init.exception("Error while opening crash log file!") else: earlyinit.init_faulthandler(self._crash_log_file)
def test_init_faulthandler_stderr_none(monkeypatch, attr): """Make sure init_faulthandler works when sys.stderr/__stderr__ is None.""" monkeypatch.setattr(sys, attr, None) earlyinit.init_faulthandler()