Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unit tests for traceback formatting of RecursionError #1083

Closed
Delgan opened this issue Feb 17, 2024 · 0 comments · Fixed by #1239
Closed

Add unit tests for traceback formatting of RecursionError #1083

Delgan opened this issue Feb 17, 2024 · 0 comments · Fixed by #1239
Labels
enhancement Improvement to an already existing feature

Comments

@Delgan
Copy link
Owner

Delgan commented Feb 17, 2024

For example, the following snippet:

from loguru import logger

def rec():
    rec()

try:
    rec()
except Exception:
    logger.exception("Oups")

Should produce the following logs:

2024-02-17 12:06:00.577 | ERROR    | __main__:<module>:9 - Oups
Traceback (most recent call last):

> File "/home/delgan/Code/loguru/script.py", line 7, in <module>
    rec()
    └ <function rec at 0x7a13f1314720>

  File "/home/delgan/Code/loguru/script.py", line 4, in rec
    rec()
    └ <function rec at 0x7a13f1314720>

  File "/home/delgan/Code/loguru/script.py", line 4, in rec
    rec()
    └ <function rec at 0x7a13f1314720>

  File "/home/delgan/Code/loguru/script.py", line 4, in rec
    rec()
    └ <function rec at 0x7a13f1314720>
  [Previous line repeated 996 more times]

RecursionError: maximum recursion depth exceeded

Note the "[Previous line repeated 996 more times]".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to an already existing feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant