Example #1
0
    def test_set_debugging_off(self):
        log.set_debugging(True)
        log.debug('test')

        log.set_debugging(False)
        log.debug('test2')
        self.mock_log.msg.assert_called_once_with('test', logLevel='DEBUG')
Example #2
0
    def record(self, traces):
        for (trace, annotations) in traces:
            trace_key = (trace.trace_id, trace.span_id)
            self._annotations_for_trace[trace_key].extend(annotations)

            for annotation in annotations:
                if annotation.name in self._end_annotations:
                    saved_annotations = self._annotations_for_trace[trace_key]

                    del self._annotations_for_trace[trace_key]

                    log.debug(format=("Sending trace: %(trace_key)s w/"
                                      " %(annotations)s"),
                              system=self.__class__.__name__,
                              trace_key=trace_key,
                              annotations=annotations)
                    self._tracer.record([(trace, saved_annotations)])

                    break
Example #3
0
    def record(self, traces):
        for (trace, annotations) in traces:
            trace_key = (trace.trace_id, trace.span_id)
            self._annotations_for_trace[trace_key].extend(annotations)

            for annotation in annotations:
                if annotation.name in self._end_annotations:
                    saved_annotations = self._annotations_for_trace[trace_key]

                    del self._annotations_for_trace[trace_key]

                    log.debug(format=("Sending trace: %(trace_key)s w/"
                                      " %(annotations)s"),
                              system=self.__class__.__name__,
                              trace_key=trace_key,
                              annotations=annotations)
                    self._tracer.record([(trace, saved_annotations)])

                    break
Example #4
0
 def test_set_debugging_default(self):
     log.set_debugging()
     log.debug('test')
     self.mock_log.msg.assert_called_once_with('test', logLevel='DEBUG')
Example #5
0
 def test_default_debug_off(self):
     log.debug('test')
     self.assertEqual(self.mock_log.msg.call_count, 0)