1
0

PrintError: display verbosity filter

This commit is contained in:
ThomasV
2018-11-14 13:16:08 +01:00
parent e1b85327be
commit a266de6735
2 changed files with 11 additions and 4 deletions

View File

@@ -183,17 +183,23 @@ class PrintError(object):
verbosity_filter = ''
def diagnostic_name(self):
return self.__class__.__name__
return ''
def log_name(self):
msg = self.verbosity_filter or self.__class__.__name__
d = self.diagnostic_name()
if d: msg += "][" + d
return "[%s]" % msg
def print_error(self, *msg):
if self.verbosity_filter in verbosity or verbosity == '*':
print_error("[%s]" % self.diagnostic_name(), *msg)
print_error(self.log_name(), *msg)
def print_stderr(self, *msg):
print_stderr("[%s]" % self.diagnostic_name(), *msg)
print_stderr(self.log_name(), *msg)
def print_msg(self, *msg):
print_msg("[%s]" % self.diagnostic_name(), *msg)
print_msg(self.log_name(), *msg)
class ThreadJob(PrintError):
"""A job that is run periodically from a thread's main loop. run() is