Guest User

Untitled

a guest
Mar 19th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. import logging
  3. FORMAT = '%(asctime)-15s %(message)s'
  4. logging.basicConfig(format=FORMAT)
  5.  
  6. logger = logging.getLogger(__name__)
  7.  
  8.  
  9. def bar():
  10. try:
  11. raise Exception("test")
  12. except:
  13. logger.exception("oops")
  14.  
  15.  
  16. def foo():
  17. foo1()
  18.  
  19.  
  20. def foo1():
  21. foo2()
  22.  
  23.  
  24. def foo2():
  25. bar()
  26.  
  27.  
  28. if __name__ == "__main__":
  29. foo()
  30.  
  31. 2018-03-19 14:27:51,096 oops
  32. Traceback (most recent call last):
  33. File "/alextest/logexc.py", line 11, in bar
  34. raise Exception("test")
  35. Exception: test
Add Comment
Please, Sign In to add comment