|
28 | 28 | _WORKER_THREAD_NAME = 'opencensus.trace.Worker' |
29 | 29 | _WORKER_TERMINATOR = object() |
30 | 30 |
|
| 31 | +logger = logging.getLogger(__name__) |
| 32 | + |
31 | 33 |
|
32 | 34 | class _Worker(object): |
33 | 35 | """A background thread that exports batches of spans. |
@@ -85,7 +87,7 @@ def _thread_main(self): |
85 | 87 | Pulls pending SpanData tuples off the queue and writes them in |
86 | 88 | batches to the specified tracing backend using the exporter. |
87 | 89 | """ |
88 | | - print('Background thread started.') |
| 90 | + logger.debug('Background thread started.') |
89 | 91 |
|
90 | 92 | quit_ = False |
91 | 93 |
|
@@ -121,7 +123,7 @@ def _thread_main(self): |
121 | 123 | if quit_: |
122 | 124 | break |
123 | 125 |
|
124 | | - print('Background thread exited.') |
| 126 | + logger.debug('Background thread exited.') |
125 | 127 |
|
126 | 128 | def start(self): |
127 | 129 | """Starts the background thread. |
@@ -176,12 +178,12 @@ def _export_pending_spans(self): |
176 | 178 | return |
177 | 179 |
|
178 | 180 | if not self._queue.empty(): |
179 | | - print('Sending all pending spans before terminated.') |
| 181 | + logger.info('Sending all pending spans before terminated.') |
180 | 182 |
|
181 | 183 | if self.stop(): |
182 | | - print('Sent all pending spans.') |
| 184 | + logger.info('Sent all pending spans.') |
183 | 185 | else: |
184 | | - print('Failed to send pending spans.') |
| 186 | + logger.error('Failed to send pending spans.') |
185 | 187 |
|
186 | 188 | def enqueue(self, span_datas): |
187 | 189 | """Queues span_datas to be written by the background thread.""" |
|
0 commit comments