Better logging

This commit is contained in:
Ruben van de Ven 2019-09-12 14:59:03 +02:00
parent fabfb46140
commit f4f0a822b5

View file

@ -170,13 +170,16 @@ if __name__ == "__main__":
coloredlogs.install(
level=logging.DEBUG if args.verbose else logging.INFO,
)
logger.addHandler(
logging.handlers.RotatingFileHandler(
formatter = logging.Formatter(fmt='%(asctime)s %(module)s:%(lineno)d %(levelname)8s | %(message)s',
datefmt='%Y/%m/%d %H:%M:%S') # %I:%M:%S %p AM|PM format
logFileHandler = logging.handlers.RotatingFileHandler(
'mt_server.log',
maxBytes=1024*512,
backupCount=5
)
logFileHandler.setFormatter(formatter)
logger.addHandler(
logFileHandler
)