Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

Commit 7d863e1

Browse files
Olivier Cervelloc24t
authored andcommitted
Turn prints into log statements (#379)
1 parent 0373087 commit 7d863e1

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

opencensus/trace/exporters/transports/background_thread.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
_WORKER_THREAD_NAME = 'opencensus.trace.Worker'
2929
_WORKER_TERMINATOR = object()
3030

31+
logger = logging.getLogger(__name__)
32+
3133

3234
class _Worker(object):
3335
"""A background thread that exports batches of spans.
@@ -85,7 +87,7 @@ def _thread_main(self):
8587
Pulls pending SpanData tuples off the queue and writes them in
8688
batches to the specified tracing backend using the exporter.
8789
"""
88-
print('Background thread started.')
90+
logger.debug('Background thread started.')
8991

9092
quit_ = False
9193

@@ -121,7 +123,7 @@ def _thread_main(self):
121123
if quit_:
122124
break
123125

124-
print('Background thread exited.')
126+
logger.debug('Background thread exited.')
125127

126128
def start(self):
127129
"""Starts the background thread.
@@ -176,12 +178,12 @@ def _export_pending_spans(self):
176178
return
177179

178180
if not self._queue.empty():
179-
print('Sending all pending spans before terminated.')
181+
logger.info('Sending all pending spans before terminated.')
180182

181183
if self.stop():
182-
print('Sent all pending spans.')
184+
logger.info('Sent all pending spans.')
183185
else:
184-
print('Failed to send pending spans.')
186+
logger.error('Failed to send pending spans.')
185187

186188
def enqueue(self, span_datas):
187189
"""Queues span_datas to be written by the background thread."""

0 commit comments

Comments
 (0)