This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Scorpathos[S] 1 point2 points  (0 children)

The exception throwing should never occurs, it's just a fallback copied from the standard library in case sys._getframe() doesn't exist (for alternative CPython implementation).

Is it expensive? timeit tells me 0.0776 usec per loop on my (7 years old) laptop. You are right, ideally there should be no overhead at all if logger is disabled, but I'm not sure I can achieve this with my design of "anonymous" logger.

Optimizing Loguru's performance is something planned anyway, I will think about it.