示例#1
0
    def export_log(self):
        folder = osa_api.choose_folder(self.lang.menu_export_log)
        if folder is not None:
            log_str = Log.extract_log()
            err_str = Log.extract_err()

            if log_str != '':
                with open('%s/%s' % (folder, '%s.log' % Const.app_name), 'w') as io:
                    io.write(log_str)

            if err_str != '':
                with open('%s/%s' % (folder, '%s.err' % Const.app_name), 'w') as io:
                    io.write(err_str)
示例#2
0
    def export_log(self):
        folder = QFileDialog.getExistingDirectory(
            None, caption=self.lang.menu_export_log)
        if folder is not None:
            log = Log.extract_log()
            err = Log.extract_err()

            for f in Config._protect_fields:
                v = getattr(Config, f, '')
                if v != '':
                    log = log.replace(v, Const.protector)
                    err = err.replace(v, Const.protector)

            if log != '':
                with open('%s/%s' % (folder, '%s.log' % Const.app_name),
                          'w') as io:
                    io.write(log)

            if err != '':
                with open('%s/%s' % (folder, '%s.err' % Const.app_name),
                          'w') as io:
                    io.write(err)