changeset 1591:668958454ae2

shuffle some logging
author drewp@bigasterisk.com
date Sat, 04 Sep 2021 15:34:29 -0700
parents 327202020892
children d7b66234064b
files service/mqtt_to_rdf/inference.py
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/service/mqtt_to_rdf/inference.py	Thu Sep 02 23:20:55 2021 -0700
+++ b/service/mqtt_to_rdf/inference.py	Sat Sep 04 15:34:29 2021 -0700
@@ -222,19 +222,20 @@
 
 def verifyBinding(lhs: Graph, binding: Dict[BindableTerm, Node], workingSet: Graph, usedByFuncs: Graph) -> bool:
     """Can this lhs be true all at once in workingSet? Does it match with these bindings?"""
-    log.debug(f'                verify all bindings against this lhs:')
     boundLhs = list(withBinding(lhs, binding))
-    for stmt in boundLhs:
-        log.debug(f'                    {stmt}')
+    boundUsedByFuncs = list(withBinding(usedByFuncs, binding))
+    if log.isEnabledFor(logging.DEBUG):
+        log.debug(f'                verify all bindings against this lhs:')
+        for stmt in boundLhs:
+            log.debug(f'                    {stmt}')
 
-    log.debug(f'                and against this workingSet:')
-    for stmt in workingSet:
-        log.debug(f'                    {stmt}')
+        log.debug(f'                and against this workingSet:')
+        for stmt in workingSet:
+            log.debug(f'                    {stmt}')
 
-    log.debug(f'                ignoring these usedByFuncs:')
-    boundUsedByFuncs = list(withBinding(usedByFuncs, binding))
-    for stmt in boundUsedByFuncs:
-        log.debug(f'                    {stmt}')
+        log.debug(f'                ignoring these usedByFuncs:')
+        for stmt in boundUsedByFuncs:
+            log.debug(f'                    {stmt}')
     # The static stmts in lhs are obviously going
     # to match- we only need to verify the ones
     # that needed bindings.