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

Open
Delgan opened this issue Feb 17, 2024 · 0 comments
Open

Add unit tests for traceback formatting of RecursionError #1083

Delgan opened this issue Feb 17, 2024 · 0 comments
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]".

@Delgan Delgan added the enhancement Improvement to an already existing feature label Feb 17, 2024
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

No branches or pull requests

1 participant