Set debugging level based on debugplot value.

    Parameters
    ----------
    debugplot : int
            Debugging level for messages and plots. For details see
            'numina.array.display.pause_debugplot.py'.
969983
def logging_from_debugplot(debugplot):
    

    if isinstance(debugplot, int):
        if abs(debugplot) >= 10:
            logging.basicConfig(level=logging.DEBUG)
        else:
            logging.basicConfig(level=logging.INFO)
    else:
        raise ValueError("Unexpected debugplot=" + str(debugplot))
1364193
def _StartDebugger():
  """"""
  global _hub_client
  global _breakpoints_manager

  cdbg_native.InitializeModule(_flags)

  _hub_client = gcp_hub_client.GcpHubClient()
  visibility_policy = _GetVisibilityPolicy()

  _breakpoints_manager = breakpoints_manager.BreakpointsManager(
      _hub_client,
      visibility_policy)

  # Set up loggers for logpoints.
  capture_collector.SetLogger(logging.getLogger())

  capture_collector.CaptureCollector.pretty_printers.append(
      appengine_pretty_printers.PrettyPrinter)

  _hub_client.on_active_breakpoints_changed = (
      _breakpoints_manager.SetActiveBreakpoints)
  _hub_client.on_idle = _breakpoints_manager.CheckBreakpointsExpiration
  _hub_client.SetupAuth(
      _flags.get('project_id'),
      _flags.get('project_number'),
      _flags.get('service_account_json_file'))
  _hub_client.InitializeDebuggeeLabels(_flags)
  _hub_client.Start()
752255
protected function setDebugMode($debug)
    {
        error_reporting(0);
        // Enable error_reporting
        if ($debug) {
            error_reporting(E_ALL);
            ini_set('display_errors', true);
            ini_set('display_startup_errors', true);
        }
    }
1245409
async def debug_text(self, texts: Union[str, list], positions: Union[list, set], color=(0, 255, 0), size_px=16):
        
        if isinstance(positions, (set, list)):
            if not positions:
                return

            if isinstance(texts, str):
                texts = [texts] * len(positions)
            assert len(texts) == len(positions)

            await self._execute(
                debug=sc_pb.RequestDebug(
                    debug=[
                        debug_pb.DebugCommand(
                            draw=debug_pb.DebugDraw(
                                text=[
                                    debug_pb.DebugText(
                                        text=t,
                                        color=debug_pb.Color(r=color[0], g=color[1], b=color[2]),
                                        world_pos=common_pb.Point(x=p.x, y=p.y, z=getattr(p, "z", 10)),
                                        size=size_px,
                                    )
                                    for t, p in zip(texts, positions)
                                ]
                            )
                        )
                    ]
                )
            )
        else:
            await self.debug_text([texts], [positions], color)
606767
def set_debug_listener(stream):
    """"""

    def debugger(sig, frame):
        launch_debugger(frame, stream)

    if hasattr(signal, 'SIGUSR1'):
        signal.signal(signal.SIGUSR1, debugger)
    else:
        logger.warn("Cannot set SIGUSR1 signal for debug mode.")
1228701
def debug_callback(event, *args, **kwds):
    '''
    '''
    l = ['event %s' % (event.type,)]
    if args:
        l.extend(map(str, args))
    if kwds:
        l.extend(sorted('%s=%s' % t for t in kwds.items()))
    print('Debug callback (%s)' % ', '.join(l))
977332
def on(self, level):
        
        if isinstance(level, int) and level >= 0 and level <= 3:
            self._debug_level = level
227891
def set_debug(self, debuglevel):
        
        if isinstance(debuglevel, int):
            self._debuglevel = debuglevel

        if self._debuglevel == 1:
            logging.basicConfig(level=logging.INFO,
                                format="%(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s")
            api_logger.setLevel(logging.INFO)
        elif self._debuglevel == 2:
            logging.basicConfig(level=logging.DEBUG,
                                format="%(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s")
            requests.cookies.cookielib.debug = True
            api_logger.setLevel(logging.DEBUG)
        elif self._debuglevel >= 3:
            logging.basicConfig(level=logging.DEBUG,
                                format="%(levelname)s [%(name)s.%(funcName)s:%(lineno)d] %(message)s")
            requests.cookies.cookielib.debug = True
            api_logger.setLevel(logging.DEBUG)
            urllib3_logger = logging.getLogger("requests.packages.urllib3")
            urllib3_logger.setLevel(logging.DEBUG)
            urllib3_logger.propagate = True
        else:
            # Remove all handlers
            for handler in logging.root.handlers[:]:
                logging.root.removeHandler(handler)
            # set logging level to default
            requests.cookies.cookielib.debug = False
            api_logger.setLevel(logging.WARNING)

        return
1043641
def to_debug_message(
        self, text: str, color=None, pos: Optional[Union[Point2, Point3]] = None, size: int = 8
    ) -> debug_pb.DebugText:
        
        color = self.to_debug_color(color)
        pt3d = self.to_debug_point(pos) if isinstance(pos, Point3) else None
        virtual_pos = self.to_debug_point(pos) if not isinstance(pos, Point3) else None

        return debug_pb.DebugText(color=color, text=text, virtual_pos=virtual_pos, world_pos=pt3d, size=size)
1061398
def _debug(self):
        """"""
        self.window.blit(self.surfaceUp, (self.loc[0], 10))
        self.window.blit(self.surfaceOver, (self.loc[0], 60))
        self.window.blit(self.surfaceDown, (self.loc[0], 110))
        self.window.blit(self.surfaceDisabled, (self.loc[0], 160))
335824
def debug(self, *msg):
        
        label = colors.yellow("DEBUG")
        self._msg(label, *msg)
575288
def debug(self, message, *args, **kwargs):
        
        self.system.debug(message, *args, **kwargs)
627300
def debug(dbg=True):
    """"""
    global _debug_handler
    if dbg and _debug_handler is None:
        _debug_handler = logging.StreamHandler()
        logger.addHandler(_debug_handler)
        logger.setLevel(logging.DEBUG)
    elif not dbg and _debug_handler is not None:
        logger.removeHandler(_debug_handler)
        _debug_handler = None
        logger.setLevel(logging.WARNING)
624381
def log(self, level, message):
        
        if level <= self._debug_level:
            self._write_log("debug", Settings.LogTime, message)
439153
def set_level(self, level):
        
        args = {
            'level': level,
        }
        self._level_chk.check(args)

        return self._client.json('logger.set_level', args)
654405
def set_log_level(debug, verbose):
    
    if debug:
        logging.basicConfig(level=logging.DEBUG)
    elif verbose:
        logging.basicConfig(level=logging.INFO)
301193
def _GetDebuggeeDescription(self):
    """"""
    return '-'.join(self._debuggee_labels[label]
                    for label in _DESCRIPTION_LABELS
                    if label in self._debuggee_labels)