debian/vendor/hypercorn/trio/statsd.py
raw| 1 | from __future__ import annotations |
| 2 | |
| 3 | import trio |
| 4 | |
| 5 | from ..config import Config |
| 6 | from ..statsd import StatsdLogger as Base |
| 7 | |
| 8 | |
| 9 | class StatsdLogger(Base): |
| 10 | def __init__(self, config: Config) -> None: |
| 11 | super().__init__(config) |
| 12 | self.address = tuple(config.statsd_host.rsplit(":", 1)) |
| 13 | self.socket = trio.socket.socket(trio.socket.AF_INET, trio.socket.SOCK_DGRAM) |
| 14 | |
| 15 | async def _socket_send(self, message: bytes) -> None: |
| 16 | await self.socket.sendto(message, self.address) |