I just found this solution from a thread in BA.
I just throw the
log.py into the
blender\3.0\scripts\modules (installation path is not strict - just anywhere that the
sys.path can look can do). And it works.
Why isn’t this superb solution offered in the Blender distro? Everything is great as of now.
P.S. Though the solution is a workaround, the most proper and standard implementation is to have C code written. But in any case even this workaround if considered safe, it won’t be bad at all.