Skip to content

Commit

Permalink
Merge pull request sopel-irc#2420 from sopel-irc/safety-logging-tweaks
Browse files Browse the repository at this point in the history
safety: logging level tweaks
  • Loading branch information
dgw authored Mar 18, 2023
2 parents 4bc3233 + 091aa90 commit 8b098bf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sopel/modules/safety.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@ def setup(bot: Sopel):
except Exception as err:
# for lack of a more specific error type...
# Python on Windows throws an exception if the file is in use
LOGGER.info('Could not delete %s: %s', old_file, str(err))
LOGGER.warning('Could not delete %s: %s', old_file, str(err))

LOGGER.info('Ensuring unsafe domain list is up-to-date (safety plugin setup)')
update_local_cache(bot, init=True)


Expand All @@ -141,12 +142,12 @@ def download_domain_list(bot: Sopel, path: str) -> bool:
url = bot.settings.safety.domain_blocklist_url
if url is None or not url.startswith("http"):
url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
LOGGER.info("Downloading unsafe domain list from %s", url)
LOGGER.debug("Downloading unsafe domain list from %s", url)
old_etag = bot.db.get_plugin_value("safety", "unsafe_domain_list_etag")
if old_etag:
r = requests.head(url)
if r.headers["ETag"] == old_etag and os.path.isfile(path):
LOGGER.info("Unsafe domain list unchanged, skipping")
LOGGER.debug("Unsafe domain list unchanged, skipping")
return False

r = requests.get(url, stream=True)
Expand Down Expand Up @@ -486,6 +487,6 @@ def _clean_cache(bot: Sopel):

LOGGER.debug('Safety cache cleanup finished.')
else:
LOGGER.info(
LOGGER.debug(
'Skipping safety cache cleanup: Cache is locked, '
'cleanup already running.')

0 comments on commit 8b098bf

Please sign in to comment.