Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
line = line.rstrip()
# Log everything to cnchi-alpm.log
self.logger.debug(line)
logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
if not level & logmask:
# Only log errors and warnings
return
if level & pyalpm.LOG_ERROR:
logging.error(line)
elif level & pyalpm.LOG_WARNING:
logging.warning(line)
elif level & pyalpm.LOG_DEBUG or level & pyalpm.LOG_FUNCTION:
logging.debug(line)
def cb_log(level, line):
if not (level & _logmask):
return
if level & pyalpm.LOG_ERROR:
line = "ERROR: " + line
elif level & pyalpm.LOG_WARNING:
line = "WARNING: " + line
elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line
elif level & pyalpm.LOG_FUNCTION:
line = "FUNC: " + line
sys.stderr.write(line)
return
if level & pyalpm.LOG_ERROR:
ErrorDialog.format_secondary_text("ERROR: "+line)
response = ErrorDialog.run()
if response:
ErrorDialog.hide()
#t.release()
elif level & pyalpm.LOG_WARNING:
WarningDialog.format_secondary_text("WARNING: "+line)
response = WarningDialog.run()
if response:
WarningDialog.hide()
elif level & pyalpm.LOG_DEBUG:
line = "DEBUG: " + line
print(line)
elif level & pyalpm.LOG_FUNCTION:
line = "FUNC: " + line
print(line)
#sys.stderr.write(line)