Get rid of warnings from logging.warn

logging.warn is deprecated [1].

[1] https://docs.python.org/3/library/logging.html#logging.Logger.warning
This commit is contained in:
Chih-Hsuan Yen 2018-12-15 19:44:26 +08:00 committed by Chih-Hsuan Yen
parent 2677d29f1d
commit 7dab7c3b6a
No known key found for this signature in database
GPG Key ID: 0453A6CA23C56315
4 changed files with 4 additions and 4 deletions

View File

@ -189,7 +189,7 @@ class Source:
else:
conf = config[name]
if not conf.getboolean('missing_ok', False):
logger.warn('no-result', name=name)
logger.warning('no-result', name=name)
self.on_no_result(name)
if self.newver:

View File

@ -14,7 +14,7 @@ async def get_version(name, conf, **kwargs):
try:
regex = re.compile(conf['regex'])
except sre_constants.error:
logger.warn('bad regex, skipped.', name=name, exc_info=True)
logger.warning('bad regex, skipped.', name=name, exc_info=True)
return
encoding = conf.get('encoding', 'latin1')

View File

@ -42,7 +42,7 @@ def take():
oldvers[name] = newvers[name]
except KeyError:
if args.ignore_nonexistent:
logger.warn('nonexistent in newver, ignored', name=name)
logger.warning('nonexistent in newver, ignored', name=name)
continue
logger.critical(

View File

@ -62,7 +62,7 @@ def event_loop(request):
@pytest.fixture(scope="session", autouse=True)
def raise_on_logger_msg():
def proc(logger, method_name, event_dict):
if method_name in ('warn', 'error'):
if method_name in ('warning', 'error'):
if 'exc_info' in event_dict:
raise event_dict['exc_info']
raise RuntimeError(event_dict['event'])