Skip to content

Instantly share code, notes, and snippets.

@Rotzke
Last active September 26, 2021 20:40
Show Gist options
  • Save Rotzke/7e36c740ab4599f69bad6b040993464b to your computer and use it in GitHub Desktop.
Save Rotzke/7e36c740ab4599f69bad6b040993464b to your computer and use it in GitHub Desktop.
Logging module config
# stdout
logging.basicConfig(format='[%(asctime)s] %(levelname)s: %(message)s',
level=logging.INFO, datefmt='%Y/%m/%dT%H:%M:%S')
# file
logging.basicConfig(filename="log",
filemode='a',
format='%(asctime)s,%(msecs)d %(name)s %(levelname)s %(message)s',
datefmt='%H:%M:%S',
level=logging.DEBUG)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment