From c6482dad2278c01fa9b84fc37355654b283b29cb Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sun, 4 Dec 2016 17:57:53 +0100 Subject: merge_dist: Prefix logging lines with nodename. --- tools/merge_dist.py | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'tools/merge_dist.py') diff --git a/tools/merge_dist.py b/tools/merge_dist.py index aa793e6..e2e3e0d 100755 --- a/tools/merge_dist.py +++ b/tools/merge_dist.py @@ -25,7 +25,7 @@ from mergetools import get_curpos, get_logorder, chunks, get_missingentries, \ def sendlog_helper(entries, curpos, nodename, nodeaddress, own_key, paths, statusupdates): - logging.info("sending log") + logging.info("%s: sending log", nodename) for chunk in chunks(entries, 1000): for trynumber in range(5, 0, -1): sendlogresult = sendlog(nodename, nodeaddress, @@ -35,15 +35,15 @@ def sendlog_helper(entries, curpos, nodename, nodeaddress, own_key, paths, if trynumber == 1: sys.exit(1) sleep(10) - logging.warning("tries left: %d", trynumber) + logging.warning("%s: tries left: %d", nodename, trynumber) continue break if sendlogresult["result"] != "ok": - logging.error("sendlog: %s", sendlogresult) + logging.error("%s: sendlog: %s", nodename, sendlogresult) sys.exit(1) curpos += len(chunk) statusupdates.status("PROG sending log: %d" % curpos) - logging.info("log sent") + logging.info("%s: log sent", nodename) def fill_in_missing_entries(nodename, nodeaddress, own_key, paths, chainsdb, timing, statusupdates): @@ -52,7 +52,8 @@ def fill_in_missing_entries(nodename, nodeaddress, own_key, paths, chainsdb, timing_point(timing, "get missing") while missingentries: - logging.info("about to send %d missing entries", len(missingentries)) + logging.info("%s: about to send %d missing entries", nodename, + len(missingentries)) sent_entries = 0 with requests.sessions.Session() as session: for missingentry_chunk in chunks(missingentries, 100): @@ -62,7 +63,8 @@ def fill_in_missing_entries(nodename, nodeaddress, own_key, paths, chainsdb, own_key, paths, hashes_and_entries, session) if sendentryresult["result"] != "ok": - logging.error("sendentries: %s", sendentryresult) + logging.error("%s: sendentries: %s", nodename, + sendentryresult) sys.exit(1) sent_entries += len(missingentry_hashes) statusupdates.status( @@ -83,15 +85,15 @@ def do_send(args, localconfig, frontendnode, logorder, sth, chainsdb, s): nodename = frontendnode["name"] nodeaddress = "https://%s/" % frontendnode["address"] - logging.info("distributing for node %s", nodename) + logging.info("%s: distributing", nodename) curpos = get_curpos(nodename, nodeaddress, own_key, paths) timing_point(timing, "get curpos") - logging.info("current position %d", curpos) + logging.info("%s: current position %d", nodename, curpos) verifiedsize = \ get_frontend_verifiedsize(nodename, nodeaddress, own_key, paths) timing_point(timing, "get verified size") - logging.info("verified size %d", verifiedsize) + logging.info("%s: verified size %d", nodename, verifiedsize) assert verifiedsize >= curpos @@ -106,15 +108,16 @@ def do_send(args, localconfig, frontendnode, logorder, sth, chainsdb, s): verifiedsize = frontend_verify_entries(nodename, nodeaddress, own_key, paths, uptopos) - logging.info("sending sth to node %s", nodename) + logging.info("%s: sending sth", nodename) publishsthresult = publish_sth(nodename, nodeaddress, own_key, paths, sth) if publishsthresult["result"] != "ok": - logging.info("publishsth: %s", publishsthresult) + logging.info("%s: publishsth: %s", nodename, publishsthresult) sys.exit(1) timing_point(timing, "send sth") if args.timing: - logging.debug("timing: merge_dist: %s", timing["deltatimes"]) + logging.debug("%s: timing: merge_dist: %s", nodename, + timing["deltatimes"]) def merge_dist_sequenced(args, localconfig, frontendnodes, chainsdb, s): paths = localconfig["paths"] -- cgit v1.1