Better logging
This commit is contained in:
parent
fabfb46140
commit
f4f0a822b5
1 changed files with 9 additions and 6 deletions
|
@ -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
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue