Ver Fonte

Mute logging.

Stefano Cossu há 6 anos atrás
pai
commit
74c1fce0bd
2 ficheiros alterados com 16 adições e 16 exclusões
  1. 6 6
      lakesuperior/model/graph/callbacks.pyx
  2. 10 10
      lakesuperior/model/graph/graph.pyx

+ 6 - 6
lakesuperior/model/graph/callbacks.pyx

@@ -23,11 +23,11 @@ cdef int term_cmp_fn(const void* key1, const void* key2):
     b2 = <Buffer *>key2
 
     if b1.sz != b2.sz:
-        logger.info(f'Sizes differ: {b1.sz} != {b2.sz}. Return 1.')
+        #logger.info(f'Sizes differ: {b1.sz} != {b2.sz}. Return 1.')
         return 1
 
     cdef int cmp = memcmp(b1.addr, b2.addr, b1.sz)
-    logger.info(f'term memcmp: {cmp}')
+    #logger.info(f'term memcmp: {cmp}')
     return cmp
 
 
@@ -50,7 +50,7 @@ cdef int trp_cmp_fn(const void* key1, const void* key2):
         term_cmp_fn(t1.p, t2.p)
     )
 
-    logger.info(f'Triples match: {not(diff)}')
+    #logger.info(f'Triples match: {not(diff)}')
     return diff
 
 
@@ -241,9 +241,9 @@ cdef inline void del_trp_callback(
     """
     Remove a triple from a graph as a result of a lookup callback.
     """
-    logger.info('removing triple: {} {} {}'.format(
-        buffer_dump(trp.s), buffer_dump(trp.p), buffer_dump(trp.o)
-    ))
+    #logger.info('removing triple: {} {} {}'.format(
+        #buffer_dump(trp.s), buffer_dump(trp.p), buffer_dump(trp.o)
+    #))
     gr.remove_triple(trp)
 
 

+ 10 - 10
lakesuperior/model/graph/graph.pyx

@@ -101,9 +101,9 @@ cdef class SimpleGraph:
 
         cc.hashset_iter_init(&ti, self._triples)
         while cc.hashset_iter_next(&ti, &void_p) != cc.CC_ITER_END:
-            logger.info(f'Data loop.')
+            #logger.info(f'Data loop.')
             if void_p == NULL:
-                logger.warn('Triple is NULL!')
+                #logger.warn('Triple is NULL!')
                 break
 
             trp = <BufferTriple *>void_p
@@ -616,20 +616,20 @@ cdef class SimpleGraph:
         if copy:
             trp = self.store_triple(trp)
 
-        logger.info('Inserting terms.')
+        #logger.info('Inserting terms.')
         cc.hashset_add(self._terms, trp.s)
         cc.hashset_add(self._terms, trp.p)
         cc.hashset_add(self._terms, trp.o)
-        logger.info('inserted terms.')
-        logger.info(f'Terms set size: {cc.hashset_size(self._terms)}')
+        #logger.info('inserted terms.')
+        #logger.info(f'Terms set size: {cc.hashset_size(self._terms)}')
 
         cdef size_t trp_sz = cc.hashset_size(self._triples)
-        logger.info(f'Triples set size before adding: {trp_sz}')
+        #logger.info(f'Triples set size before adding: {trp_sz}')
 
         r = cc.hashset_add(self._triples, trp)
 
         trp_sz = cc.hashset_size(self._triples)
-        logger.info(f'Triples set size after adding: {trp_sz}')
+        #logger.info(f'Triples set size after adding: {trp_sz}')
 
         cdef:
             cc.HashSetIter ti
@@ -688,7 +688,7 @@ cdef class SimpleGraph:
         """
         _data = self.data
 
-        logger.debug(f'Slicing graph by: {s}, {p}, {o}.')
+        #logger.debug(f'Slicing graph by: {s}, {p}, {o}.')
         if s is None and p is None and o is None:
             return _data
         elif s is None and p is None:
@@ -754,7 +754,7 @@ cdef class SimpleGraph:
 
         # Decide comparison logic outside the loop.
         if s is not None and p is not None and o is not None:
-            logger.info('Looping over one triple only.')
+            #logger.info('Looping over one triple only.')
             # Shortcut for 3-term match.
             trp.s = &ss
             trp.p = &sp
@@ -888,7 +888,7 @@ cdef class Imr(SimpleGraph):
         """
         # TODO use slice.
         values = {trp[2] for trp in self.lookup((self.uri, p, None))}
-        logger.info(f'Values found: {values}')
+        #logger.info(f'Values found: {values}')
 
         if strict and len(values) > 1:
             raise RuntimeError('More than one value found for {}, {}.'.format(