Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python logging basicconfig stdout

# https://stackoverflow.com/a/14058475
import logging
import sys

root = logging.getLogger()
root.setLevel(logging.DEBUG)

handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
root.addHandler(handler)
Source by zetcode.com #
 
PREVIOUS NEXT
Tagged: #python #logging #basicconfig #stdout
ADD COMMENT
Topic
Name
2+9 =