Spaces:
Running
on
Zero
Running
on
Zero
import logging | |
logger = logging.getLogger("guardian-demo") | |
logger.setLevel(logging.DEBUG) | |
formatter = logging.Formatter("%(asctime)s - %(filename)s:%(lineno)d - %(message)s", datefmt="%Y-%m-%d %H:%M:%S") | |
stream_handler = logging.StreamHandler() | |
stream_handler.setLevel(logging.DEBUG) | |
stream_handler.setFormatter(formatter) | |
logger.addHandler(stream_handler) | |
file_handler = logging.FileHandler("logs.txt") | |
file_handler.setFormatter(formatter) | |
logger.addHandler(file_handler) | |