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(
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue