Squelch excessive logging

This commit is contained in:
Mark Qvist 2023-10-26 12:53:18 +02:00
parent cf6d88f17e
commit f531b2ecaa
4 changed files with 37 additions and 1 deletions

View File

@ -52,6 +52,21 @@ from mapview import CustomMapMarker
from mapview.mbtsource import MBTilesMapSource from mapview.mbtsource import MBTilesMapSource
from mapview.source import MapSource 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": if RNS.vendor.platformutils.get_platform() == "android":
from sideband.core import SidebandCore from sideband.core import SidebandCore

View File

@ -16,6 +16,7 @@ from kivy.logger import LOG_LEVELS, Logger
from mapview.constants import CACHE_DIR from mapview.constants import CACHE_DIR
import logging
# if "MAPVIEW_DEBUG_DOWNLOADER" in environ: # if "MAPVIEW_DEBUG_DOWNLOADER" in environ:
# Logger.setLevel(LOG_LEVELS['debug']) # Logger.setLevel(LOG_LEVELS['debug'])
# Logger.setLevel(LOG_LEVELS['error']) # Logger.setLevel(LOG_LEVELS['error'])
@ -52,6 +53,18 @@ class Downloader:
if not exists(self.cache_dir): if not exists(self.cache_dir):
makedirs(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): def submit(self, f, *args, **kwargs):
future = self.executor.submit(f, *args, **kwargs) future = self.executor.submit(f, *args, **kwargs)
self._futures.append(future) self._futures.append(future)

View File

@ -729,7 +729,7 @@ class MapView(Widget):
post_multiply=True, post_multiply=True,
anchor=scatter.to_local(x, y), 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: else:
pass pass
# print(f"Self = {self._scale} Scale = {scale} Rescale = {rescale} Zoom = {self.zoom}") # print(f"Self = {self._scale} Scale = {scale} Rescale = {rescale} Zoom = {self.zoom}")

View File

@ -18,6 +18,14 @@ from .sense import Telemeter
if RNS.vendor.platformutils.get_platform() == "android": if RNS.vendor.platformutils.get_platform() == "android":
from jnius import autoclass, cast 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(): class PropagationNodeDetector():
EMITTED_DELTA_GRACE = 300 EMITTED_DELTA_GRACE = 300