Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

Commit 354d73c

Browse files
authored
PubSub: Renaming logger -> _LOGGER since at module scope. (#4459)
1 parent 7a913fc commit 354d73c

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

  • google/cloud/pubsub_v1/subscriber/policy

google/cloud/pubsub_v1/subscriber/policy/thread.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
from google.cloud.pubsub_v1.subscriber.message import Message
2929

3030

31-
logger = logging.getLogger(__name__)
31+
_LOGGER = logging.getLogger(__name__)
3232

3333

3434
def _callback_completed(future):
3535
"""Simple callback that just logs a `Future`'s result."""
36-
logger.debug('Result: %s', future.result())
36+
_LOGGER.debug('Result: %s', future.result())
3737

3838

3939
class Policy(base.BasePolicy):
@@ -80,7 +80,7 @@ def __init__(self, client, subscription, flow_control=types.FlowControl(),
8080
)
8181

8282
# Also maintain a request queue and an executor.
83-
logger.debug('Creating callback requests thread (not starting).')
83+
_LOGGER.debug('Creating callback requests thread (not starting).')
8484
if executor is None:
8585
executor = futures.ThreadPoolExecutor(max_workers=10)
8686
self._executor = executor
@@ -122,7 +122,7 @@ def open(self, callback):
122122
self._future = Future(policy=self)
123123

124124
# Start the thread to pass the requests.
125-
logger.debug('Starting callback requests worker.')
125+
_LOGGER.debug('Starting callback requests worker.')
126126
self._callback = callback
127127
self._consumer.helper_threads.start(
128128
'callback requests worker',
@@ -135,7 +135,7 @@ def open(self, callback):
135135

136136
# Spawn a helper thread that maintains all of the leases for
137137
# this policy.
138-
logger.debug('Spawning lease maintenance worker.')
138+
_LOGGER.debug('Spawning lease maintenance worker.')
139139
self._leaser = threading.Thread(target=self.maintain_leases)
140140
self._leaser.daemon = True
141141
self._leaser.start()
@@ -168,8 +168,8 @@ def on_response(self, response):
168168
For each message, schedule a callback with the executor.
169169
"""
170170
for msg in response.received_messages:
171-
logger.debug('New message received from Pub/Sub: %r', msg)
172-
logger.debug(self._callback)
171+
_LOGGER.debug('New message received from Pub/Sub: %r', msg)
172+
_LOGGER.debug(self._callback)
173173
message = Message(msg.message, msg.ack_id, self._request_queue)
174174
future = self._executor.submit(self._callback, message)
175175
future.add_done_callback(_callback_completed)

0 commit comments

Comments
 (0)