Closed andy-landy closed 3 years ago
Hi @andy-landy, thanks for the message. The functionality works well, I did struggle a little with implementation and understanding the docs, but that may be down to my Python skill level. How would a decorator on the main function be implemented? Thanks, Glenn
Would it be using @prints_exc decorator on main function?
I added some examples, e.g. with a decorator https://github.com/andy-landy/traceback_with_variables/blob/master/examples/print_for_function.py
You can just move it to main as well:
@prints_exc
def main():...
or
@prints_exc(fmt=Format(...), file_=...)
def main():...
to customize the output and/or where to print it
But if you need just the simplest solution and there's only 1 process and 1 thread, and you're fine with all defaults, you can just add
from traceback_with_variables import activate_by_import
in the beginning and that will be the only line related to this lib in the code.
I feel I need to make some better overview in the readme, yeah I feel it too ;) The thing is I cannot create a text that would differ from sort of printing out all examples one-by-one, but I'll try some time next month.
Thanks @andy-landy for the further info and use cases, will give them a go and hopefully reduce and simplify my code
Updates work great, thanks @andy-landy
Hi, I want to keep
traceback-with-variables
as convenient as possible, so I collect feedback from its users :) It looks like a pull request is the only way to communicate on github though. If you feel like spending a minute to leave a couple sentences, I'd appreciate.Would it be more convenient if anything was implemented in some different way? Are there any missing features? Maybe it needs more examples (e.g. it seems, that decorated
def main
would be more appropriate than overloadedsys.excepthook
since it does the same but logging code resides at one place)?