Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def cb_log(level, line):
#global t
#try:
# _line = str(_line, encoding='utf-8').strip("\n")
#except:
# _line = str(_line, encoding='latin-1').strip("\n")
if not (level & _logmask):
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)
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)
line = line.rstrip()
if "error 31 from alpm_db_get_pkg" in line:
# It's ok not to show this error because we search the package
# in all repos, and obviously it will only be in one of them,
# throwing errors when searching in the other ones
return
if "command failed to execute correctly" in line:
# We get this warning sometimes (I think it's when Cnchi installs
# the kernel package). It seems to be harmless, we'll log it as
# a debug message instead of an error message
logging.debug(line)
return
if level & pyalpm.LOG_ERROR == pyalpm.LOG_ERROR:
logging.error(line)
elif level & pyalpm.LOG_WARNING == pyalpm.LOG_WARNING:
# Alpm outputs non-english log messages so we can't target certain
# useless warnings. I think most of the warnings are useless anyway.
# We can revisit this later if need be.
logging.debug(line)
elif level & pyalpm.LOG_DEBUG == pyalpm.LOG_DEBUG:
# There are a lot of "extracting" messages (not very useful), so we
# do not log them.
if " error " in line and "error 0" not in line:
logging.debug(line)
elif "extracting" not in line and "extract: skipping dir extraction" not in line:
logging.debug(line)
def cb_log(self, level, line):
# Only manage error and warning messages
_logmask = pyalpm.LOG_ERROR | pyalpm.LOG_WARNING
if not (level & _logmask):
return
if level & pyalpm.LOG_ERROR or level & pyalpm.LOG_WARNING:
# Even if there is a real error we're not sure we want to abort all installation
# Instead of issuing a fatal error we just log an error message
logging.error(line)
'''
if level & pyalpm.LOG_ERROR: