mirror of
				https://github.com/liberatedsystems/openCom-Companion.git
				synced 2025-07-08 05:07:21 +02:00 
			
		
		
		
	Squelch excessive logging
This commit is contained in:
		
							parent
							
								
									cf6d88f17e
								
							
						
					
					
						commit
						f531b2ecaa
					
				@ -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
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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)
 | 
			
		||||
 | 
			
		||||
@ -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}")
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user