Better logging
This commit is contained in:
parent
fabfb46140
commit
f4f0a822b5
1 changed files with 9 additions and 6 deletions
15
server.py
15
server.py
|
@ -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',
|
||||||
|
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(
|
logger.addHandler(
|
||||||
logging.handlers.RotatingFileHandler(
|
logFileHandler
|
||||||
'mt_server.log',
|
|
||||||
maxBytes=1024*512,
|
|
||||||
backupCount=5
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue