Spaces:
Running
on
Zero
Running
on
Zero
File size: 412 Bytes
d46878a 5b7f169 d46878a 1a38959 5b7f169 1a38959 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import logging
logger = logging.getLogger("demo")
logger.setLevel(logging.DEBUG)
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.DEBUG)
logger.addHandler(stream_handler)
file_handler = logging.FileHandler("logs.txt")
file_handler.setFormatter(
logging.Formatter("%(asctime)s - %(filename)s:%(lineno)d - %(message)s", datefmt="%Y-%m-%d %H:%M:%S")
)
logger.addHandler(file_handler)
|