Open cool-RR opened 4 years ago
Anyone who wants to implement this, we'll need to do a lot of work on defining the design and use cases before starting to implement.
Until something is designed and implemented, I've written a small utility to convert pysnooper logs to html pages, with folds based on the indentation.
It's clearly not perfect as there is no syntaxic coloration, nor a way to search for a specific term in the page, but it's better than looking at all the logs manually.
https://gist.github.com/cxs-kge/689597fd216b0a64b5bf0c35354cd0b4
Cool, thank you.
I've been using this little script to strip and diff two pysnooper's outputs
sed -r 's/[0-9]+ |//' -i $1
sed -e 's/at 0x[a-z0-9]\+/at XXX/g' -i $1
sed -e 's/line [0-9]\+/line YYY/g' -i $1
Put it in a file like strip_snoop.sh and use with path to file strip_snoop.sh <file>
.
I thought the normalize parameter would help now with the updated version.
I've put it into a gist if that helps and for updates
Btw. coloring has been added to output, but i wasn't able to disable it. I am investigating what's wrong with my setup, but I have at least few tips related to exploring outputs. I think diff is the tool to be used, if the output is stripped off undiffable data. normalize
should help here but it doesn't seem to do what I wanted and also would consider automatically triggering color=False
when using normalize
and file output. I might put it into separate issues/feature request if I have time to explore what's really going on with the coloring now.
Sorry for spamming this thread, but I should mention I found the problem. I assumed the output file is always overwritten with new content, but it is appended by default. There doesn't seem to be a switch to change this behavior, so I am using snoop(open('<filepath>', 'w'), ...)
. Everything works now.
Thanks Martin. Right now I don't have this need, but next time I'll have it I'll look into your scripts.
It happened that I was using PySnooper with
depth=10000
to explore a piece of running code. Of course, the output was huge with many levels of indentations. I wanted to explore it, but it was difficult to track the execution of a single function.It would be cool if there was a tool that accepted PySnooper outputs and allow some useful use cases of exploring them to find what you want.