def debug(msg, parent=None, traceDepth=0): if DEBUG: msg = '%s %s' % (_debugHeader(parent, traceDepth), msg) print('%sDEBUG%s: %s' % (bcolors.OKBLUE, bcolors.ENDC, msg), file=sys.stdout) for line in tools.wrap_line(msg): syslog.syslog(syslog.LOG_DEBUG, 'DEBUG: %s' % line)
def update_info( self ): if not tools.is_process_alive( self.ppid ): self.prepare_exit() self.qapp.exit(0) return message = self.snapshots.get_take_snapshot_message() if message is None and self.last_message is None: message = ( 0, _('Working...') ) if not message is None: if message != self.last_message: self.last_message = message self.menuStatusMessage.setText('\n'.join(tools.wrap_line(self.last_message[1],\ size = 80,\ delimiters = '',\ new_line_indicator = '') \ )) self.status_icon.setToolTip( self.last_message[1] ) pg = progress.ProgressFile(self.config) if pg.isFileReadable(): pg.load() percent = pg.get_int_value('percent') if percent != self.progressBar.value(): self.progressBar.setValue(percent) self.progressBar.render(self.pixmap, sourceRegion = QRegion(0, -14, 24, 6), flags = QWidget.RenderFlags(QWidget.DrawChildren)) self.status_icon.setIcon(QIcon(self.pixmap)) self.menuProgress.setText(' | '.join(self.getMenuProgress(pg)) ) self.menuProgress.setVisible(True) else: self.status_icon.setIcon(self.icon.BIT_LOGO) self.menuProgress.setVisible(False)
def warning(msg, parent=None, traceDepth=0): if DEBUG: msg = '%s %s' % (_debugHeader(parent, traceDepth), msg) print('%sWARNING%s: %s' % (bcolors.WARNING, bcolors.ENDC, msg), file=sys.stderr) for line in tools.wrap_line(msg): syslog.syslog(syslog.LOG_WARNING, 'WARNING: ' + line)
def info(msg, parent=None, traceDepth=0): if DEBUG: msg = '%s %s' % (_debugHeader(parent, traceDepth), msg) print('%sINFO%s: %s' % (bcolors.OKGREEN, bcolors.ENDC, msg), file=sys.stdout) for line in tools.wrap_line(msg): syslog.syslog(syslog.LOG_INFO, 'INFO: ' + line)
def update_info(self): if not tools.is_process_alive(self.ppid): self.prepare_exit() self.qapp.exit(0) return message = self.snapshots.get_take_snapshot_message() if message is None and self.last_message is None: message = (0, _('Working...')) if not message is None: if message != self.last_message: self.last_message = message self.menuStatusMessage.setText('\n'.join(tools.wrap_line(self.last_message[1],\ size = 80,\ delimiters = '',\ new_line_indicator = '') \ )) self.status_icon.setToolTip(self.last_message[1]) pg = progress.ProgressFile(self.config) if pg.isFileReadable(): pg.load() percent = pg.get_int_value('percent') if percent != self.progressBar.value(): self.progressBar.setValue(percent) self.progressBar.render(self.pixmap, sourceRegion=QRegion(0, -14, 24, 6), flags=QWidget.RenderFlags( QWidget.DrawChildren)) self.status_icon.setIcon(QIcon(self.pixmap)) self.menuProgress.setText(' | '.join(self.getMenuProgress(pg))) self.menuProgress.setVisible(True) else: self.status_icon.setIcon(self.icon.BIT_LOGO) self.menuProgress.setVisible(False)
def error(msg, parent=None, traceDepth=0): if DEBUG: msg = '%s %s' % (_debugHeader(parent, traceDepth), msg) print('%sERROR%s: %s' % (bcolors.FAIL, bcolors.ENDC, msg), file=sys.stderr) for line in tools.wrap_line(msg): syslog.syslog(syslog.LOG_ERR, 'ERROR: ' + line)
def debug(msg, parent = None, traceDepth = 0): if DEBUG: msg = '%s %s' %(_debugHeader(parent, traceDepth), msg) print('%sDEBUG%s: %s' %(bcolors.OKBLUE, bcolors.ENDC, msg), file = sys.stdout) for line in tools.wrap_line(msg): syslog.syslog(syslog.LOG_DEBUG, 'DEBUG: %s' %line)
def info(msg , parent = None, traceDepth = 0): if DEBUG: msg = '%s %s' %(_debugHeader(parent, traceDepth), msg) print('%sINFO%s: %s' %(bcolors.OKGREEN, bcolors.ENDC, msg), file=sys.stdout) for line in tools.wrap_line(msg): syslog.syslog( syslog.LOG_INFO, 'INFO: ' + line )
def warning(msg , parent = None, traceDepth = 0): if DEBUG: msg = '%s %s' %(_debugHeader(parent, traceDepth), msg) print('%sWARNING%s: %s' %(bcolors.WARNING, bcolors.ENDC, msg), file=sys.stderr) for line in tools.wrap_line(msg): syslog.syslog( syslog.LOG_WARNING, 'WARNING: ' + line )
def error(msg , parent = None, traceDepth = 0): if DEBUG: msg = '%s %s' %(_debugHeader(parent, traceDepth), msg) print('%sERROR%s: %s' %(bcolors.FAIL, bcolors.ENDC, msg), file=sys.stderr) for line in tools.wrap_line(msg): syslog.syslog( syslog.LOG_ERR, 'ERROR: ' + line )