# HG changeset patch # User drewp@bigasterisk.com # Date 1371365278 0 # Node ID c50b7d6fcc4eff0f9157fd75e6a716ecb47f3e7b # Parent ee84e1fbca73dad00a7bf0757f116aec9f452748 don't log huge json patch bodies, but do print how big they are and how long they took Ignore-this: ba479815d0e5bd45247ed8c32a932010 diff -r ee84e1fbca73 -r c50b7d6fcc4e light9/rdfdb/patchsender.py --- a/light9/rdfdb/patchsender.py Sun Jun 16 04:03:54 2013 +0000 +++ b/light9/rdfdb/patchsender.py Sun Jun 16 06:47:58 2013 +0000 @@ -1,4 +1,4 @@ -import logging +import logging, time import cyclone.httpclient from twisted.internet import defer log = logging.getLogger('syncedgraph') @@ -96,12 +96,17 @@ kwargs will become extra attributes in the toplevel json object """ + t1 = time.time() body = patch.makeJsonRepr(kw) - log.debug("send body: %r", body) + jsonTime = time.time() - t1 + intro = body[:200] + if len(body) > 200: + intro = intro + "..." + log.debug("send body (rendered %.1fkB in %.1fms): %s", len(body) / 1024, jsonTime * 1000, intro) def putDone(done): if not str(done.code).startswith('2'): raise ValueError("sendPatch request failed %s: %s" % (done.code, done.body)) - log.debug("sendPatch finished, response: %s" % done.body) + log.debug("sendPatch finished, response: %r" % done.body) return done return cyclone.httpclient.fetch(