Commit 3d5d36dc authored by Alessandro CERIONI's avatar Alessandro CERIONI
Browse files

Replacing prints by calls to the logging module

parent 6657e009
......@@ -4,6 +4,7 @@ import hashlib
import codecs
import os
import time
import logging
from yaml import load, dump
......@@ -15,6 +16,7 @@ except ImportError:
with open("config.yaml", 'r') as yamlfile:
cfg = load(yamlfile, Loader=Loader)
logging.basicConfig(format="[%(asctime)s] [%(process)d] [%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S %z")
def refresh_cache():
......@@ -35,18 +37,18 @@ def refresh_cache():
# if file_found == False or age > 86400:
print('Fetching a new file...')'Fetching a new file...')
done = False
while not done:
res = requests.get(url)
if res.status_code != 200:
print('Something went wrong. Sleeping for 5 seconds before retrying...')
logging.error('Something went wrong. Sleeping for 5 seconds before retrying...')
done = False
done = True
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment