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