I noticed in some cases with a lot of async functions flying around, this logging overhead can become quite dramatic.
In the worst case I had a task taking 60 seconds drop to 15 after killing all the logging (as in removing the lines, not just disabling the logger).
So I've tackled this in two ways.
Using pythons lazy logging. So that if there is no handler picking up the debug messages, we have no string formatting overhead.
Tying the debug logging in the event loop to the built in "(set|get)_debug" state. So even with debug logging enabled, the messages from the event loop can selectively be enabled/disabled.
I noticed in some cases with a lot of async functions flying around, this logging overhead can become quite dramatic. In the worst case I had a task taking 60 seconds drop to 15 after killing all the logging (as in removing the lines, not just disabling the logger). So I've tackled this in two ways.