Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import logging
- import sys
- import traceback
- def func3():
- 1 / 0
- def func2():
- try:
- func3()
- except Exception:
- logging.exception('Error calling func3', stack_info=True)
- #f = sys._getframe(1)
- #print('Stack (most recent call last):')
- #traceback.print_stack(f)
- def func1():
- logging.debug('How did we get here?', stack_info=True)
- func2()
- logging.debug('Not sure how we got here!')
- def main():
- func1()
- if __name__ == '__main__':
- logging.basicConfig(level=logging.DEBUG, format='%(message)s')
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement