mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 08:21:27 +00:00
PrintError: display verbosity filter
This commit is contained in:
parent
e1b85327be
commit
a266de6735
2 changed files with 11 additions and 4 deletions
|
@ -138,6 +138,7 @@ def serialize_server(host: str, port: Union[str, int], protocol: str) -> str:
|
|||
|
||||
|
||||
class Interface(PrintError):
|
||||
verbosity_filter = 'i'
|
||||
|
||||
def __init__(self, network: 'Network', server: str, config_path, proxy: dict):
|
||||
self.ready = asyncio.Future()
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue