electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit a266de6735c5be059f78ae42e23af3c07fe80c22
parent e1b85327bed94f99fb239c6cb6bff672e392b6aa
Author: ThomasV <thomasv@electrum.org>
Date:   Wed, 14 Nov 2018 13:16:08 +0100

PrintError: display verbosity filter

Diffstat:
Melectrum/interface.py | 1+
Melectrum/util.py | 14++++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/electrum/interface.py b/electrum/interface.py @@ -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() diff --git a/electrum/util.py b/electrum/util.py @@ -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