当前位置: 首页>>代码示例>>Python>>正文


Python LOGGER.error方法代码示例

本文整理汇总了Python中ycmd.utils.LOGGER.error方法的典型用法代码示例。如果您正苦于以下问题:Python LOGGER.error方法的具体用法?Python LOGGER.error怎么用?Python LOGGER.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ycmd.utils.LOGGER的用法示例。


在下文中一共展示了LOGGER.error方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _ReaderLoop

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
  def _ReaderLoop( self ):
    """
    Read responses from TSServer and use them to resolve
    the DeferredResponse instances.
    """

    while True:
      self._tsserver_is_running.wait()

      try:
        message = self._ReadMessage()
      except ( RuntimeError, ValueError ):
        LOGGER.exception( 'Error while reading message from server' )
        if not self._ServerIsRunning():
          self._tsserver_is_running.clear()
        continue

      # We ignore events for now since we don't have a use for them.
      msgtype = message[ 'type' ]
      if msgtype == 'event':
        eventname = message[ 'event' ]
        LOGGER.info( 'Received %s event from TSServer',  eventname )
        continue
      if msgtype != 'response':
        LOGGER.error( 'Unsupported message type', msgtype )
        continue

      seq = message[ 'request_seq' ]
      with self._pending_lock:
        if seq in self._pending:
          self._pending[ seq ].resolve( message )
          del self._pending[ seq ]
开发者ID:christophermca,项目名称:dotfiles,代码行数:34,代码来源:typescript_completer.py

示例2: GetClangdExecutableAndResourceDir

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
def GetClangdExecutableAndResourceDir( user_options ):
  """Return the Clangd binary from the path specified in the
  'clangd_binary_path' option. Let the binary find its resource directory in
  that case. If no binary is found or if it's out-of-date, return nothing. If
  'clangd_binary_path' is empty, return the third-party Clangd and its resource
  directory if the user downloaded it and if it's up to date. Otherwise, return
  nothing."""
  clangd = user_options[ 'clangd_binary_path' ]
  resource_dir = None

  if clangd:
    clangd = FindExecutable( ExpandVariablesInPath( clangd ) )

    if not clangd:
      LOGGER.error( 'No Clangd executable found at %s',
                    user_options[ 'clangd_binary_path' ] )
      return None, None

    if not CheckClangdVersion( clangd ):
      LOGGER.error( 'Clangd at %s is out-of-date', clangd )
      return None, None

  # Try looking for the pre-built binary.
  else:
    third_party_clangd = GetThirdPartyClangd()
    if not third_party_clangd:
      return None, None
    clangd = third_party_clangd
    resource_dir = CLANG_RESOURCE_DIR

  LOGGER.info( 'Using Clangd from %s', clangd )
  return clangd, resource_dir
开发者ID:SolaWing,项目名称:ycmd,代码行数:34,代码来源:clangd_completer.py

示例3: _SolutionTestCheckHeuristics

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
def _SolutionTestCheckHeuristics( candidates, tokens, i ):
  """ Test if one of the candidate files stands out """
  path = os.path.join( *tokens[ : i + 1 ] )
  selection = None
  # if there is just one file here, use that
  if len( candidates ) == 1 :
    selection = os.path.join( path, candidates[ 0 ] )
    LOGGER.info( 'Selected solution file %s as it is the first one found',
                 selection )

  # there is more than one file, try some hints to decide
  # 1. is there a solution named just like the subdirectory with the source?
  if ( not selection and i < len( tokens ) - 1 and
       u'{0}.sln'.format( tokens[ i + 1 ] ) in candidates ):
    selection = os.path.join( path, u'{0}.sln'.format( tokens[ i + 1 ] ) )
    LOGGER.info( 'Selected solution file %s as it matches source subfolder',
                 selection )

  # 2. is there a solution named just like the directory containing the
  # solution?
  if not selection and u'{0}.sln'.format( tokens[ i ] ) in candidates :
    selection = os.path.join( path, u'{0}.sln'.format( tokens[ i ] ) )
    LOGGER.info( 'Selected solution file %s as it matches containing folder',
                 selection )

  if not selection:
    LOGGER.error( 'Could not decide between multiple solution files:\n%s',
                  candidates )

  return selection
开发者ID:SolaWing,项目名称:ycmd,代码行数:32,代码来源:solutiondetection.py

示例4: StartServer

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
  def StartServer( self, request_data ):
    with self._server_state_mutex:
      LOGGER.info( 'Starting %s: %s',
                   self.GetServerName(),
                   self.GetCommandLine() )

      self._stderr_file = utils.CreateLogfile( '{}_stderr'.format(
        utils.MakeSafeFileNameString( self.GetServerName() ) ) )

      with utils.OpenForStdHandle( self._stderr_file ) as stderr:
        self._server_handle = utils.SafePopen( self.GetCommandLine(),
                                               stdin = subprocess.PIPE,
                                               stdout = subprocess.PIPE,
                                               stderr = stderr )

      self._connection = (
        lsc.StandardIOLanguageServerConnection(
          self._server_handle.stdin,
          self._server_handle.stdout,
          self.GetDefaultNotificationHandler() )
      )

      self._connection.Start()

      try:
        self._connection.AwaitServerConnection()
      except lsc.LanguageServerConnectionTimeout:
        LOGGER.error( '%s failed to start, or did not connect successfully',
                      self.GetServerName() )
        self.Shutdown()
        return False

    LOGGER.info( '%s started', self.GetServerName() )

    return True
开发者ID:SolaWing,项目名称:ycmd,代码行数:37,代码来源:simple_language_server_completer.py

示例5: ShouldEnableTypeScriptCompleter

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
def ShouldEnableTypeScriptCompleter():
  tsserver = FindTSServer()
  if not tsserver:
    LOGGER.error( 'Not using TypeScript completer: TSServer not installed '
                  'in %s', TSSERVER_DIR )
    return False
  LOGGER.info( 'Using TypeScript completer with %s', tsserver )
  return True
开发者ID:christophermca,项目名称:dotfiles,代码行数:10,代码来源:typescript_completer.py

示例6: StartServer

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
  def StartServer( self, request_data, project_directory = None ):
    with self._server_state_mutex:
      LOGGER.info( 'Starting jdt.ls Language Server...' )

      if project_directory:
        self._java_project_dir = project_directory
      else:
        self._java_project_dir = _FindProjectDir(
          os.path.dirname( request_data[ 'filepath' ] ) )

      self._workspace_path = _WorkspaceDirForProject(
        self._java_project_dir,
        self._use_clean_workspace )

      command = [
        PATH_TO_JAVA,
        '-Dfile.encoding=UTF-8',
        '-Declipse.application=org.eclipse.jdt.ls.core.id1',
        '-Dosgi.bundles.defaultStartLevel=4',
        '-Declipse.product=org.eclipse.jdt.ls.core.product',
        '-Dlog.level=ALL',
        '-jar', self._launcher_path,
        '-configuration', self._launcher_config,
        '-data', self._workspace_path,
      ]

      LOGGER.debug( 'Starting java-server with the following command: %s',
                    command )

      self._server_stderr = utils.CreateLogfile( 'jdt.ls_stderr_' )
      with utils.OpenForStdHandle( self._server_stderr ) as stderr:
        self._server_handle = utils.SafePopen( command,
                                               stdin = PIPE,
                                               stdout = PIPE,
                                               stderr = stderr )

      self._connection = (
        language_server_completer.StandardIOLanguageServerConnection(
          self._server_handle.stdin,
          self._server_handle.stdout,
          self.GetDefaultNotificationHandler() )
      )

      self._connection.Start()

      try:
        self._connection.AwaitServerConnection()
      except language_server_completer.LanguageServerConnectionTimeout:
        LOGGER.error( 'jdt.ls failed to start, or did not connect '
                      'successfully' )
        self.Shutdown()
        return False

    LOGGER.info( 'jdt.ls Language Server started' )

    return True
开发者ID:SolaWing,项目名称:ycmd,代码行数:58,代码来源:java_completer.py

示例7: GetThirdPartyClangd

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
def GetThirdPartyClangd():
  pre_built_clangd = GetExecutable( PRE_BUILT_CLANDG_PATH )
  if not pre_built_clangd:
    LOGGER.info( 'No Clangd executable found in %s', PRE_BUILT_CLANGD_DIR )
    return None
  if not CheckClangdVersion( pre_built_clangd ):
    LOGGER.error( 'Clangd executable at %s is out-of-date', pre_built_clangd )
    return None
  LOGGER.info( 'Clangd executable found at %s and up to date',
               PRE_BUILT_CLANGD_DIR )
  return pre_built_clangd
开发者ID:SolaWing,项目名称:ycmd,代码行数:13,代码来源:clangd_completer.py

示例8: StartServer

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
  def StartServer( self, request_data ):
    with self._server_state_mutex:
      if self.ServerIsHealthy():
        return

      # We have to get the settings before starting the server, as this call
      # might throw UnknownExtraConf.
      extra_conf_dir = self._GetSettingsFromExtraConf( request_data )

      # Ensure we cleanup all states.
      self._Reset()

      LOGGER.info( 'Starting clangd: %s', self._clangd_command )
      self._stderr_file = utils.CreateLogfile( 'clangd_stderr' )
      with utils.OpenForStdHandle( self._stderr_file ) as stderr:
        self._server_handle = utils.SafePopen( self._clangd_command,
                                               stdin = subprocess.PIPE,
                                               stdout = subprocess.PIPE,
                                               stderr = stderr )

      self._connection = (
        language_server_completer.StandardIOLanguageServerConnection(
          self._server_handle.stdin,
          self._server_handle.stdout,
          self.GetDefaultNotificationHandler() )
      )

      self._connection.Start()

      try:
        self._connection.AwaitServerConnection()
      except language_server_completer.LanguageServerConnectionTimeout:
        LOGGER.error( 'clangd failed to start, or did not connect '
                      'successfully' )
        self.Shutdown()
        return

    LOGGER.info( 'clangd started' )

    self.SendInitialize( request_data, extra_conf_dir = extra_conf_dir )
开发者ID:christophermca,项目名称:dotfiles,代码行数:42,代码来源:clangd_completer.py

示例9: Get3rdPartyClangd

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
def Get3rdPartyClangd():
  pre_built_clangd = os.path.abspath( os.path.join(
    os.path.dirname( __file__ ),
    '..',
    '..',
    '..',
    'third_party',
    'clangd',
    'output',
    'bin',
    'clangd' ) )
  pre_built_clangd = utils.GetExecutable( pre_built_clangd )
  if not CheckClangdVersion( pre_built_clangd ):
    error = 'clangd binary at {} is out-of-date please update.'.format(
               pre_built_clangd )
    global REPORTED_OUT_OF_DATE
    if not REPORTED_OUT_OF_DATE:
      REPORTED_OUT_OF_DATE = True
      raise RuntimeError( error )
    LOGGER.error( error )
    return None
  return pre_built_clangd
开发者ID:christophermca,项目名称:dotfiles,代码行数:24,代码来源:clangd_completer.py

示例10: __init__

# 需要导入模块: from ycmd.utils import LOGGER [as 别名]
# 或者: from ycmd.utils.LOGGER import error [as 别名]
  def __init__( self, user_options ):
    super( RustCompleter, self ).__init__( user_options )
    self._racerd_binary = FindRacerdBinary( user_options )
    self._racerd_port = None
    self._racerd_host = None
    self._server_state_lock = threading.RLock()
    self._keep_logfiles = user_options[ 'server_keep_logfiles' ]
    self._hmac_secret = ''
    self._rust_source_path = self._GetRustSrcPath()

    if not self._rust_source_path:
      LOGGER.warning( 'No path provided for the rustc source. Please set the '
                      'rust_src_path option' )
    elif not p.isdir( self._rust_source_path ):
      LOGGER.error( NON_EXISTING_RUST_SOURCES_PATH_MESSAGE )
      raise RuntimeError( NON_EXISTING_RUST_SOURCES_PATH_MESSAGE )

    if not self._racerd_binary:
      LOGGER.error( BINARY_NOT_FOUND_MESSAGE )
      raise RuntimeError( BINARY_NOT_FOUND_MESSAGE )

    self._StartServer()
开发者ID:Valloric,项目名称:ycmd,代码行数:24,代码来源:rust_completer.py


注:本文中的ycmd.utils.LOGGER.error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。