import pathlib import asyncio import sys import random tests_dir = pathlib.Path(__file__).parent project_dir = tests_dir.parent sys.path.append(str(project_dir)) import source class logger(source.handler): async def write(self, content: str) -> None: await self._to_file(content) await self._to_stdout(content) await self._to_stderr(content) log = tests_dir / pathlib.Path("x.log") if log.is_file(): log.unlink() loging = logger(log) async def main(): await loging.write("That is so simple: " + str(random.randrange(1, 20))) async def core(): alls = list() for count in range(2000): alls.append(main()) await asyncio.gather(*alls) if __name__ == "__main__": asyncio.run(core())