def test_emit(self): exporter = logging_exporter.LoggingExporter() logger = mock.Mock() exporter.logger = logger span_datas = [ span_data_module.SpanData( name='span', context=span_context.SpanContext(trace_id='1'), span_id='1111', parent_span_id=None, attributes=None, start_time=None, end_time=None, child_span_count=None, stack_trace=None, time_events=None, links=None, status=None, same_process_as_parent_span=None, span_kind=0, ) ] exporter.emit(span_datas) logger.info.assert_called_once_with( span_data_module.format_legacy_trace_json(span_datas))
def test_emit(self): exporter = logging_exporter.LoggingExporter() logger = mock.Mock() exporter.logger = logger traces = '{traces: test}' exporter.emit(traces) logger.info.assert_called_once_with(traces)
def test_export(self): exporter = logging_exporter.LoggingExporter(transport=MockTransport) exporter.export({}) self.assertTrue(exporter.transport.export_called)
def test_constructor_explicit(self): handler = _Handler(logging.INFO) exporter = logging_exporter.LoggingExporter(handler=handler) self.assertIn(exporter.handler, logging.getLogger().handlers)
def test_constructor_default(self): exporter = logging_exporter.LoggingExporter() self.assertIn(exporter.handler, logging.getLogger().handlers) assert isinstance(exporter.handler, logging.StreamHandler)