當前位置: 首頁>>代碼示例>>Python>>正文


Python LOGGER.isEnabledFor方法代碼示例

本文整理匯總了Python中ycmd.utils.LOGGER.isEnabledFor方法的典型用法代碼示例。如果您正苦於以下問題:Python LOGGER.isEnabledFor方法的具體用法?Python LOGGER.isEnabledFor怎麽用?Python LOGGER.isEnabledFor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ycmd.utils.LOGGER的用法示例。


在下文中一共展示了LOGGER.isEnabledFor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _StartServer

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import isEnabledFor [as 別名]
  def _StartServer( self, request_data ):
    with self._server_state_mutex:
      if self._server_started:
        return

      self._server_started = True

      LOGGER.info( 'Starting Tern server...' )

      self._SetServerProjectFileAndWorkingDirectory( request_data )

      self._server_port = utils.GetUnusedLocalhostPort()

      command = [ PATH_TO_NODE,
                  PATH_TO_TERN_BINARY,
                  '--port',
                  str( self._server_port ),
                  '--host',
                  SERVER_HOST,
                  '--persistent',
                  '--no-port-file' ]

      if LOGGER.isEnabledFor( logging.DEBUG ):
        command.append( '--verbose' )

      LOGGER.debug( 'Starting tern with the following command: %s', command )

      self._server_stdout = utils.CreateLogfile(
          LOGFILE_FORMAT.format( port = self._server_port, std = 'stdout' ) )

      self._server_stderr = utils.CreateLogfile(
          LOGFILE_FORMAT.format( port = self._server_port, std = 'stderr' ) )

      # We need to open a pipe to stdin or the Tern server is killed.
      # See https://github.com/ternjs/tern/issues/740#issuecomment-203979749
      # For unknown reasons, this is only needed on Windows and for Python
      # 3.4+ on other platforms.
      with utils.OpenForStdHandle( self._server_stdout ) as stdout:
        with utils.OpenForStdHandle( self._server_stderr ) as stderr:
          self._server_handle = utils.SafePopen(
            command,
            stdin = PIPE,
            stdout = stdout,
            stderr = stderr,
            cwd = self._server_working_dir )

      if self._ServerIsRunning():
        LOGGER.info( 'Tern Server started with pid %d listening on port %d',
                     self._server_handle.pid, self._server_port )
        LOGGER.info( 'Tern Server log files are %s and %s',
                     self._server_stdout, self._server_stderr )

        self._do_tern_project_check = True
      else:
        LOGGER.warning( 'Tern server did not start successfully' )
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:57,代碼來源:tern_completer.py

示例2: GetClangdCommand

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import isEnabledFor [as 別名]
def GetClangdCommand( user_options ):
  global CLANGD_COMMAND
  # None stands for we tried to fetch command and failed, therefore it is not
  # the default.
  if CLANGD_COMMAND != NOT_CACHED:
    LOGGER.info( 'Returning cached Clangd command: %s', CLANGD_COMMAND )
    return CLANGD_COMMAND
  CLANGD_COMMAND = None

  installed_clangd, resource_dir = GetClangdExecutableAndResourceDir(
      user_options )
  if not installed_clangd:
    return None

  CLANGD_COMMAND = [ installed_clangd ]
  clangd_args = user_options[ 'clangd_args' ]
  put_resource_dir = False
  put_limit_results = False
  put_header_insertion_decorators = False
  put_log = False
  for arg in clangd_args:
    CLANGD_COMMAND.append( arg )
    put_resource_dir = put_resource_dir or arg.startswith( '-resource-dir' )
    put_limit_results = put_limit_results or arg.startswith( '-limit-results' )
    put_header_insertion_decorators = ( put_header_insertion_decorators or
                        arg.startswith( '-header-insertion-decorators' ) )
    put_log = put_log or arg.startswith( '-log' )
  if not put_header_insertion_decorators:
    CLANGD_COMMAND.append( '-header-insertion-decorators=0' )
  if resource_dir and not put_resource_dir:
    CLANGD_COMMAND.append( '-resource-dir=' + resource_dir )
  if user_options[ 'clangd_uses_ycmd_caching' ] and not put_limit_results:
    CLANGD_COMMAND.append( '-limit-results=500' )
  if LOGGER.isEnabledFor( logging.DEBUG ) and not put_log:
    CLANGD_COMMAND.append( '-log=verbose' )

  return CLANGD_COMMAND
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:39,代碼來源:clangd_completer.py

示例3: _LogLevel

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import isEnabledFor [as 別名]
def _LogLevel():
  return 'verbose' if LOGGER.isEnabledFor( logging.DEBUG ) else 'normal'
開發者ID:christophermca,項目名稱:dotfiles,代碼行數:4,代碼來源:typescript_completer.py


注:本文中的ycmd.utils.LOGGER.isEnabledFor方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。