Revert back to using logging over console.log where possible

It seems the commit I made to do this change initially seemed to help, it was actually pointless and issues I had were caused by other problems.

For consistency it seems best to stick with the logging module with the RichHandler applied. Using just console.log means being unable to control the log level and which level of logs appear.
This commit is contained in:
rlaphoenix
2023-02-26 21:03:36 +00:00
parent 401d0481df
commit eb3f268d64
10 changed files with 134 additions and 120 deletions

View File

@@ -53,17 +53,17 @@ class Service(metaclass=ABCMeta):
# no explicit proxy, let's get one to GEOFENCE if needed
current_region = get_ip_info(self.session)["country"].lower()
if any(x.lower() == current_region for x in self.GEOFENCE):
console.log("Service is not Geoblocked in your region")
self.log.info("Service is not Geoblocked in your region")
else:
requested_proxy = self.GEOFENCE[0] # first is likely main region
console.log(f"Service is Geoblocked in your region, getting a Proxy to {requested_proxy}")
self.log.info(f"Service is Geoblocked in your region, getting a Proxy to {requested_proxy}")
for proxy_provider in ctx.obj.proxy_providers:
self.proxy = proxy_provider.get_proxy(requested_proxy)
if self.proxy:
console.log(f"Got Proxy from {proxy_provider.__class__.__name__}")
self.log.info(f"Got Proxy from {proxy_provider.__class__.__name__}")
break
else:
console.log("Service has no Geofence")
self.log.info("Service has no Geofence")
if self.proxy:
self.session.proxies.update({"all": self.proxy})