diff --git a/sbapp/main.py b/sbapp/main.py index 617f44a..b807a7c 100644 --- a/sbapp/main.py +++ b/sbapp/main.py @@ -52,6 +52,21 @@ from mapview import CustomMapMarker from mapview.mbtsource import MBTilesMapSource from mapview.source import MapSource +class redirect_log(): + def isEnabledFor(self, arg): + return False + def debug(self, arg): + pass + def trace(self, arg): + pass + def warning(self, arg): + RNS.log("Kivy error: "+str(arg), RNS.LOG_WARNING) + def critical(self, arg): + RNS.log("Kivy error: "+str(arg), RNS.LOG_ERROR) + +import kivy.core.image +kivy.core.image.Logger = redirect_log() + if RNS.vendor.platformutils.get_platform() == "android": from sideband.core import SidebandCore diff --git a/sbapp/mapview/downloader.py b/sbapp/mapview/downloader.py index ac3aa9a..f219ff6 100644 --- a/sbapp/mapview/downloader.py +++ b/sbapp/mapview/downloader.py @@ -16,6 +16,7 @@ from kivy.logger import LOG_LEVELS, Logger from mapview.constants import CACHE_DIR +import logging # if "MAPVIEW_DEBUG_DOWNLOADER" in environ: # Logger.setLevel(LOG_LEVELS['debug']) # Logger.setLevel(LOG_LEVELS['error']) @@ -52,6 +53,18 @@ class Downloader: if not exists(self.cache_dir): makedirs(self.cache_dir) + logging.getLogger("urllib3").setLevel(logging.WARNING) + logging.getLogger("urllib3.response").setLevel(logging.WARNING) + logging.getLogger("urllib3.connection").setLevel(logging.WARNING) + logging.getLogger("urllib3.connectionpool").setLevel(logging.WARNING) + logging.getLogger("requests").setLevel(logging.WARNING) + + logging.getLogger("urllib3").propagate = True + logging.getLogger("requests").propagate = True + logging.getLogger("urllib3.response").propagate = True + logging.getLogger("urllib3.connection").propagate = True + logging.getLogger("urllib3.connectionpool").propagate = True + def submit(self, f, *args, **kwargs): future = self.executor.submit(f, *args, **kwargs) self._futures.append(future) diff --git a/sbapp/mapview/view.py b/sbapp/mapview/view.py index 87ab15d..79b06fc 100644 --- a/sbapp/mapview/view.py +++ b/sbapp/mapview/view.py @@ -729,7 +729,7 @@ class MapView(Widget): post_multiply=True, anchor=scatter.to_local(x, y), ) - print(f"Snapped scale. Self = {self._scale} Scale = {scale}") + # print(f"Snapped scale. Self = {self._scale} Scale = {scale}") else: pass # print(f"Self = {self._scale} Scale = {scale} Rescale = {rescale} Zoom = {self.zoom}") diff --git a/sbapp/sideband/core.py b/sbapp/sideband/core.py index dc43875..a423092 100644 --- a/sbapp/sideband/core.py +++ b/sbapp/sideband/core.py @@ -18,6 +18,14 @@ from .sense import Telemeter if RNS.vendor.platformutils.get_platform() == "android": from jnius import autoclass, cast + import jnius.reflect + class redirect_log(): + def isEnabledFor(self, arg): + return False + def debug(self, arg): + pass + jnius.reflect.log = redirect_log() + class PropagationNodeDetector(): EMITTED_DELTA_GRACE = 300