aiofiles already exist On Wed, Apr 4, 2018 at 6:05 PM Guido van Rossum <gvanros...@gmail.com> wrote:
> There's code in trio for treating the filesystem as async, and massive > docs about when to use and when not. (Thanks Nathaniel!) We should consider > adding that to asyncio, perhaps as a 3rd party package. > > On Wed, Apr 4, 2018, 01:22 INADA Naoki <songofaca...@gmail.com> wrote: > >> You're right. logging.FileHandler **may** block. >> >> More precisely, FileHanlder calls flush, but not fsync or fdatasync. >> So your application won't be blocked unless your application produce >> massive logs. When it is blocked is up to your system (OS setting, >> DISK I/O speed, etc...) >> >> To avoid potential blocking, I recommend using PIPE. >> For example, you can send your log to Apache rotatelogs through PIPE. >> >> >> >> >> On Tue, Apr 3, 2018 at 5:13 PM, cr0hn cr0hn <cr...@cr0hn.com> wrote: >> > Hi folks, >> > >> > After looking a lot on the internet I can't find an answer for that. I >> > expose my doubt: >> > >> > Asyncio can't access to disk without blocking the event-loop. right? For >> > example if I'm using aiohttp or Sanic, I can't write in a file in one >> of my >> > end-points, without block the loop. Then... Can I use standard logging >> > library with the FileHandler to log into a file without blocking the >> event >> > loop? >> > >> > Thanks in advance! >> >> >> >> -- >> INADA Naoki <songofaca...@gmail.com> >> > -- Thanks, Andrew Svetlov