Skip to content

Commit

Permalink
Fix: return logger, typing
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil Dumchenko committed Dec 10, 2024
1 parent baf6178 commit 4ba1910
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions faststream/confluent/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ async def _connect( # type: ignore[override]
**kwargs,
client_id=client_id,
config=self.config,
logger=self._state.get().logger_state
)

self._producer.connect(native_producer)
Expand Down
7 changes: 5 additions & 2 deletions faststream/confluent/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class AsyncConfluentProducer:
def __init__(
self,
*,
logger: "LoggerState",
config: config_module.ConfluentFastConfig,
bootstrap_servers: Union[str, list[str]] = "localhost",
client_id: Optional[str] = None,
Expand All @@ -64,6 +65,8 @@ def __init__(
sasl_plain_password: Optional[str] = None,
sasl_plain_username: Optional[str] = None,
) -> None:
self.logger_state = logger

if isinstance(bootstrap_servers, Iterable) and not isinstance(
bootstrap_servers,
str,
Expand Down Expand Up @@ -107,7 +110,7 @@ def __init__(
},
)

self.producer = Producer(final_config, logger=self.logger) # type: ignore[call-arg]
self.producer = Producer(final_config, logger=self.logger_state.logger.logger) # type: ignore[call-arg]

self.__running = True
self._poll_task = asyncio.create_task(self._poll_loop())
Expand Down Expand Up @@ -309,7 +312,7 @@ def __init__(
)

self.config = final_config
self.consumer = Consumer(final_config, logger=self.logger) # type: ignore[call-arg]
self.consumer = Consumer(final_config, logger=self.logger_state.logger.logger) # type: ignore[call-arg]

# We shouldn't read messages and close consumer concurrently
# https://github.com/airtai/faststream/issues/1904#issuecomment-2506990895
Expand Down
2 changes: 1 addition & 1 deletion faststream/rabbit/broker/broker.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from typing_extensions import Doc, override

from faststream.__about__ import SERVICE_NAME
from faststream._internal.broker.broker import BrokerUsecase
from faststream._internal.broker.broker import ABCBroker, BrokerUsecase
from faststream._internal.constants import EMPTY
from faststream._internal.publisher.proto import PublisherProto
from faststream.message import gen_cor_id
Expand Down

0 comments on commit 4ba1910

Please sign in to comment.