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

Showing tracebacks #3

Open
alexmojaki opened this issue Jun 30, 2019 · 2 comments
Open

Showing tracebacks #3

alexmojaki opened this issue Jun 30, 2019 · 2 comments
Labels
discussion Need to hear people's opinions

Comments

@alexmojaki
Copy link
Owner

Sometimes you may want to see a traceback in the snoop logs when an exception is raised (right?). Some questions to consider:

  1. Should tracebacks sometimes/always show automatically, or only when they've been turned on? Should they be turned on in snoop, install, or both?
  2. Should they show whenever they are raised, or only when they end a call?
  3. Should they show in any traced call, including inner calls that are only traced because of a high depth, or only in functions directly traced with @snoop or with snoop?
  4. Should there be a function to log the traceback manually? This could be used even if there isn't an exception being handled, just to show the current stack. What should it be called?
@alexmojaki alexmojaki added the discussion Need to hear people's opinions label Jun 30, 2019
@sirex
Copy link

sirex commented Sep 4, 2019

  1. Should there be a function to log the traceback manually? This could be used even if there isn't an exception being handled, just to show the current stack. What should it be called?

That would be really useful. I quite often want to see, who called this function. Usually I just add assert False or import traceback; traceback.print_stack() if I don't know to break code execution.

So it would be nice, to have it integrated in snoop. I imagine it to look something like this:

@snoop(stack=True)
def foo(bar):
    pass

Or with pp:

def foo(bar):
    pp(bar, stack=True)

Also it would be nice to filter stack trace, by giving list of package names, that you are interested in. For example:

pp(bar, stack=['snoop']

This would only show lines from snoop package, ignoring everything else.

@TejasAvinashShetty
Copy link

Agree with @sirex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Need to hear people's opinions
Projects
None yet
Development

No branches or pull requests

3 participants