From d905c5da72eb3e3b89b303cffbffc847b19c4850 Mon Sep 17 00:00:00 2001 From: nyyu Date: Mon, 4 Jun 2018 13:31:01 +0200 Subject: [PATCH] use native logging formatter --- CGGItemSets.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/CGGItemSets.py b/CGGItemSets.py index 6f351a4..46da54f 100644 --- a/CGGItemSets.py +++ b/CGGItemSets.py @@ -51,7 +51,7 @@ def makeItemSetFromList(list, label, key, data): } def writeItemSet(id, pos, ver, dir, session): - logging.info('Retrieving data for %s at %s' % (id, pos)) + logging.info('Retrieving data for %s at %s', id, pos) data = getChampData(id, pos, session) item_set = { @@ -71,7 +71,7 @@ def writeItemSet(id, pos, ver, dir, session): item_set['blocks'].append(makeItemSetFromList(CONSUMABLES, "Consumables | Frequent: %s", 'mostGames', data)) item_set['blocks'].append(makeItemSetFromList(TRINKETS, "Trinkets | Wins: %s", 'highestWinPercent', data)) - logging.info('Writing item set for %s at %s' % (id, pos)) + logging.info('Writing item set for %s at %s', id, pos) with open(dir.joinpath('CGG_%s_%s.json' % (id, pos)), 'w', newline='\n') as out: json.dump(item_set, out, indent=4) @@ -87,13 +87,13 @@ def main(): data = session.get('http://ddragon.leagueoflegends.com/cdn/%s/data/en_US/champion.json' % ver).json()['data'] lol_champs = [data[i] for i in data] - logging.info('LoL version: %s' % ver) - logging.info('LoL numbers of champs: %d' % len(lol_champs)) + logging.info('LoL version: %s', ver) + logging.info('LoL numbers of champs: %d', len(lol_champs)) (champs, patch) = getChampsWithPositionsAndPatch(session) - logging.info('CGG version: %s' % patch) - logging.info('CGG numbers of champs: %d' % len(champs)) + logging.info('CGG version: %s', patch) + logging.info('CGG numbers of champs: %d', len(champs)) for champ in champs: for name, positions in champ.items(): @@ -105,7 +105,7 @@ def main(): writeItemSet(c['id'], pos, patch, path, session) sleep(random.uniform(.3, .4)) else: - logging.error('%s not found in LoL champs' % name) + logging.error('%s not found in LoL champs', name) if __name__ == "__main__": main()