Skip to content

Commit 189105a

Browse files
committed
device logging update
1 parent 637985d commit 189105a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src_py/hat/gateway/engine.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def _run(self):
106106
class _DeviceProxy(aio.Resource):
107107

108108
def __init__(self,
109-
conf: json.Data,
109+
conf: common.DeviceConf,
110110
eventer_client: hat.event.eventer.Client,
111111
event_type_prefix: common.EventTypePrefix,
112112
async_group: aio.Group,
@@ -120,6 +120,7 @@ def __init__(self,
120120
self._events_queue_size = events_queue_size
121121
self._events_queue = None
122122
self._enable_event = asyncio.Event()
123+
self._log = common.create_device_logger_adapter(mlog, conf['name'])
123124

124125
self.async_group.spawn(self._run)
125126

@@ -145,8 +146,8 @@ def set_enable(self, enable: bool):
145146

146147
async def process_events(self, events: Collection[hat.event.common.Event]):
147148
if self._events_queue is None:
148-
mlog.warning("device not enabled - ignoring %s events",
149-
len(events))
149+
self._log.warning("device not enabled - ignoring %s events",
150+
len(events))
150151
return
151152

152153
await self._events_queue.put(events)
@@ -189,7 +190,7 @@ async def _run(self):
189190
await aio.uncancellable(self._close_device(device))
190191

191192
except Exception as e:
192-
mlog.error("device proxy run error: %s", e, exc_info=e)
193+
self._log.error("device proxy run error: %s", e, exc_info=e)
193194

194195
finally:
195196
self.close()

0 commit comments

Comments
 (0)