tjson-friendly debug messages. fix #659 - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 696766c370e0ec5ce94ec930cc64979f63d0f410 DIR parent 3e1a87397d3bdf056d0b45744673e2cfd083c02c HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 17 Apr 2014 17:20:07 +0200 json-friendly debug messages. fix #659 Diffstat: M lib/daemon.py | 4 ++-- M lib/interface.py | 2 +- M lib/util.py | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) --- DIR diff --git a/lib/daemon.py b/lib/daemon.py t@@ -25,7 +25,7 @@ import traceback import json import Queue from network import Network -from util import print_msg +from util import print_msg, print_stderr from simple_config import SimpleConfig t@@ -60,7 +60,7 @@ class NetworkProxy(threading.Thread): return False elif not daemon_started: - print "Starting daemon [%s]"%self.config.get('server') + print_stderr( "Starting daemon [%s]"%self.config.get('server')) daemon_started = True pid = os.fork() if (pid == 0): # The first child. DIR diff --git a/lib/interface.py b/lib/interface.py t@@ -397,7 +397,7 @@ class Interface(threading.Thread): print_error("certificate has expired:", cert_path) os.unlink(cert_path) else: - print_msg("wrong certificate", self.host) + print_error("wrong certificate", self.host) return except Exception: print_error("wrap_socket failed", self.host) DIR diff --git a/lib/util.py b/lib/util.py t@@ -17,8 +17,12 @@ def set_verbosity(b): global is_verbose is_verbose = b + def print_error(*args): if not is_verbose: return + print_stderr(*args) + +def print_stderr(*args): args = [str(item) for item in args] sys.stderr.write(" ".join(args) + "\n") sys.stderr.flush()