Skip to content

Commit 427a358

Browse files
committed
fix: scope server logging
1 parent efa102b commit 427a358

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

mause_rpc/server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
logging.basicConfig(level=logging.INFO)
2020
logging.getLogger("pika").setLevel(logging.WARN)
21+
logger = logging.getLogger(__name__)
2122

2223
T = TypeVar('T')
2324

@@ -80,7 +81,7 @@ def serve(self) -> NoReturn:
8081
self.on_server_rx_rpc_request,
8182
consumer_tag=self.server_name,
8283
)
83-
logging.info("Ready, waiting on work on %s", self.server_queue)
84+
logger.info("Ready, waiting on work on %s", self.server_queue)
8485
channel.start_consuming()
8586

8687
def on_server_rx_rpc_request(
@@ -91,14 +92,14 @@ def on_server_rx_rpc_request(
9192
_body: str,
9293
) -> None:
9394
body = dill.loads(_body)
94-
logging.info("RPC Server got request: %s", body)
95+
logger.info("RPC Server got request: %s", body)
9596

9697
res = {"key": body["key"]}
9798

9899
try:
99100
res["body"] = self._methods[body["method"]](*body["args"], **body["kwargs"])
100101
except Exception as e:
101-
logging.exception("Call to %s caused exception", body["method"])
102+
logger.exception("Call to %s caused exception", body["method"])
102103
res["exception"] = e
103104

104105
ch.basic_publish("", routing_key=properties.reply_to, body=dill.dumps(res))

0 commit comments

Comments
 (0)