changeset 72:8bf24d5a0d21

shorter debug log on initial graph sync Ignore-this: 9c1d5e4a920c304203924d4ca5a0acf7
author drewp@bigasterisk.com
date Fri, 07 Jun 2019 00:04:09 +0000
parents 8a60c172a14c
children d001fed2be04
files rdfdb/service.py rdfdb/syncedgraph.py
diffstat 2 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rdfdb/service.py	Fri Jun 07 00:03:20 2019 +0000
+++ b/rdfdb/service.py	Fri Jun 07 00:04:09 2019 +0000
@@ -33,7 +33,6 @@
 
 log = logging.getLogger('rdfdb')
 
-
 class WebsocketDisconnect(ValueError):
     pass
 
@@ -295,9 +294,8 @@
         return g
 
     def addClient(self, newClient: WebsocketClient) -> None:
-        log.info("new connection: sending all graphs to %r..." % newClient)
+        log.info("new connection: sending all graphs to %r" % newClient)
         newClient.sendPatch(Patch(addQuads=self.graph.quads(ALLSTMTS), delQuads=[]))
-
         self.clients.append(newClient)
         stats.clients = len(self.clients)
 
--- a/rdfdb/syncedgraph.py	Fri Jun 07 00:03:20 2019 +0000
+++ b/rdfdb/syncedgraph.py	Fri Jun 07 00:04:09 2019 +0000
@@ -211,7 +211,12 @@
         """
         central server has sent us a patch
         """
-        log.debug('server has sent us %s', p)
+        if log.isEnabledFor(logging.DEBUG):
+            if len(p.addQuads) > 50:
+                log.debug('server has sent us %s', p.shortSummary())
+            else:
+                log.debug('server has sent us %s', p)
+            
         self._applyPatchLocally(p)
         try:
             self.runDepsOnNewPatch(p)