From: Roland Häder Date: Wed, 21 Jun 2023 13:45:46 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=67c42a12708e4c96dff87e1a842b1f3298d84d5d;p=fba.git Continued: - fixed some logger messages to lazy format --- diff --git a/fba/http/federation.py b/fba/http/federation.py index a8291c7..751b7fc 100644 --- a/fba/http/federation.py +++ b/fba/http/federation.py @@ -178,7 +178,7 @@ def fetch_peers(domain: str, software: str) -> list: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_peers,{__name__}) - EXIT!") @@ -212,13 +212,13 @@ def fetch_peers(domain: str, software: str) -> list: logger.debug("Added instance(s) to peers") else: message = "JSON response does not contain 'federated_instances' or 'error_message'" - logger.warning(f"{message},domain='{domain}'") + logger.warning("message='%s',domain='%s'", message, domain) instances.set_last_error(domain, message) elif isinstance(data["json"], list): - # DEBUG print("DEBUG: Querying API was successful:", domain, len(data['json'])) + logger.debug("Querying API was successful: domain='%s',data[json]()=%d", domain, len(data['json'])) peers = data["json"] else: - logger.warning(f"Cannot parse data[json][]='{type(data['json'])}'") + logger.warning("Cannot parse data[json][]='%s'", type(data['json'])) logger.debug(f"Adding '{len(peers)}' for domain='{domain}'") instances.set_total_peers(domain, peers) @@ -256,7 +256,7 @@ def fetch_nodeinfo(domain: str, path: str = None) -> dict: data = dict() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (nodeinfo,{__name__}) - EXIT!") @@ -323,7 +323,7 @@ def fetch_wellknown_nodeinfo(domain: str) -> dict: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_wellknown_nodeinfo,{__name__}) - EXIT!") diff --git a/fba/networks/lemmy.py b/fba/networks/lemmy.py index 408d863..5c89174 100644 --- a/fba/networks/lemmy.py +++ b/fba/networks/lemmy.py @@ -57,7 +57,7 @@ def fetch_peers(domain: str) -> list: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_peers,{__name__}) - EXIT!") diff --git a/fba/networks/mastodon.py b/fba/networks/mastodon.py index 21e8a73..489062b 100644 --- a/fba/networks/mastodon.py +++ b/fba/networks/mastodon.py @@ -168,7 +168,7 @@ def fetch_blocks(domain: str, origin: str, nodeinfo_url: str): headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_blocks,{__name__}) - EXIT!") diff --git a/fba/networks/misskey.py b/fba/networks/misskey.py index 1ec9cb7..6407fc8 100644 --- a/fba/networks/misskey.py +++ b/fba/networks/misskey.py @@ -56,7 +56,7 @@ def fetch_peers(domain: str) -> list: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_peers,{__name__}) - EXIT!") @@ -174,7 +174,7 @@ def fetch_blocks(domain: str) -> dict: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_blocks,{__name__}) - EXIT!") diff --git a/fba/networks/peertube.py b/fba/networks/peertube.py index 60f360e..f43a798 100644 --- a/fba/networks/peertube.py +++ b/fba/networks/peertube.py @@ -52,7 +52,7 @@ def fetch_peers(domain: str) -> list: headers = tuple() try: - logger.debug(f"Checking CSRF for domain='{domain}'") + logger.debug("Checking CSRF for domain='%s'", domain) headers = csrf.determine(domain, dict()) except network.exceptions as exception: logger.warning(f"Exception '{type(exception)}' during checking CSRF (fetch_peers,{__name__}) - EXIT!")