Advertisement
Guest User

Logging basic config terminal + file

a guest
Feb 14th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. import logging
  2.  
  3. logging.basicConfig(
  4.     filename="log.log",
  5.     format="%(message)s",
  6.     level=logging.DEBUG
  7. )
  8. logging.getLogger().addHandler(logging.StreamHandler())
  9. log = logging.info
  10.  
  11. log("This message will be print out to console + file log.log")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement