4b8a9fe7b7
- Storing in the config folder allows easy access when running via docker. - Small log output change
20 lines
588 B
Python
20 lines
588 B
Python
import logging
|
|
from logging.handlers import RotatingFileHandler
|
|
|
|
# log info level logs to stdout and debug to debug file
|
|
|
|
log_format = "%(levelname)s %(asctime)s - %(message)s"
|
|
logging.basicConfig(
|
|
handlers=[RotatingFileHandler('../config/debug.log', maxBytes=100000, backupCount=10)],
|
|
level=logging.DEBUG,
|
|
format=log_format)
|
|
|
|
stream = logging.StreamHandler()
|
|
stream.setLevel(logging.INFO)
|
|
stream_format = logging.Formatter(log_format)
|
|
stream.setFormatter(stream_format)
|
|
|
|
def get_logger(name):
|
|
l = logging.getLogger(name)
|
|
l.addHandler(stream)
|
|
return l
|