Example #1
0
File: log.py Project: thinkhy/idb
async def tail_logs(
        client: CompanionClient,
        stop: asyncio.Event,
        arguments: Optional[List[str]] = None) -> AsyncIterator[str]:
    async with client.stub.log.open() as stream:
        await stream.send_message(LogRequest(arguments=arguments), end=True)
        async for message in cancel_wrapper(stream=stream, stop=stop):
            yield message.output.decode()
Example #2
0
 async def _tail_specific_logs(
     self,
     source: LogRequest.Source,
     stop: asyncio.Event,
     arguments: Optional[List[str]],
 ) -> AsyncIterator[str]:
     async with self.get_stub() as stub, stub.log.open() as stream:
         await stream.send_message(
             LogRequest(arguments=arguments, source=source), end=True
         )
         async for message in cancel_wrapper(stream=stream, stop=stop):
             yield message.output.decode()