Answers for "how to add customize name in logging.format in python"

2

python log to file and console

import logging

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s [%(levelname)s] %(message)s",
    handlers=[
        logging.FileHandler("debug.log"),
        logging.StreamHandler()
    ]
)
Posted by: Guest on April-07-2020

Code answers related to "how to add customize name in logging.format in python"

Python Answers by Framework

Browse Popular Code Answers by Language