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


Python LOGGER.exception方法代碼示例

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


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

示例1: FiletypeCompletionAvailable

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
 def FiletypeCompletionAvailable( self, filetypes ):
   try:
     self.GetFiletypeCompleter( filetypes )
     return True
   except Exception:
     LOGGER.exception( 'Semantic completion not available for %s', filetypes )
     return False
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:9,代碼來源:server_state.py

示例2: PollModule

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
def PollModule( module, filepath ):
  """ Try to use passed module in the selection process by calling
  CSharpSolutionFile on it """
  path_to_solutionfile = None
  module_hint = None
  if module:
    try:
      module_hint = module.CSharpSolutionFile( filepath )
      LOGGER.info( 'extra_conf_store suggests %s as solution file',
                   module_hint )
      if module_hint:
        # received a full path or one relative to the config's location?
        candidates = [ module_hint,
          os.path.join( os.path.dirname( getfile( module ) ),
                        module_hint ) ]
        # try the assumptions
        for path in candidates:
          if os.path.isfile( path ):
            # path seems to point to a solution
            path_to_solutionfile = path
            LOGGER.info( 'Using solution file %s selected by extra_conf_store',
                         path_to_solutionfile )
            break
    except AttributeError:
      # the config script might not provide solution file locations
      LOGGER.exception( 'Could not retrieve solution for %s'
                        'from extra_conf_store', filepath )
  return path_to_solutionfile
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:30,代碼來源:solutiondetection.py

示例3: _CleanUp

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _CleanUp( self ):
    if not self._server_keep_logfiles:
      if self._server_stderr:
        utils.RemoveIfExists( self._server_stderr )
        self._server_stderr = None

    if self._workspace_path and self._use_clean_workspace:
      try:
        shutil.rmtree( self._workspace_path )
      except OSError:
        LOGGER.exception( 'Failed to clean up workspace dir %s',
                          self._workspace_path )

    self._launcher_path = _PathToLauncherJar()
    self._launcher_config = _LauncherConfiguration()
    self._workspace_path = None
    self._java_project_dir = None
    self._received_ready_message = threading.Event()
    self._server_init_status = 'Not started'
    self._server_started = False

    self._server_handle = None
    self._connection = None
    self._started_message_sent = False

    self.ServerReset()
開發者ID:christophermca,項目名稱:dotfiles,代碼行數:28,代碼來源:java_completer.py

示例4: _ReaderLoop

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [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

示例5: _CallGlobalExtraConfMethod

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
def _CallGlobalExtraConfMethod( function_name ):
  global_ycm_extra_conf = _GlobalYcmExtraConfFileLocation()
  if not ( global_ycm_extra_conf and
           os.path.exists( global_ycm_extra_conf ) ):
    LOGGER.debug( 'No global extra conf, not calling method %s', function_name )
    return

  try:
    module = Load( global_ycm_extra_conf, force = True )
  except Exception:
    LOGGER.exception( 'Error occurred while loading global extra conf %s',
                      global_ycm_extra_conf )
    return

  if not module or not hasattr( module, function_name ):
    LOGGER.debug( 'Global extra conf not loaded or no function %s',
                  function_name )
    return

  try:
    LOGGER.info( 'Calling global extra conf method %s on conf file %s',
                 function_name,
                 global_ycm_extra_conf )
    getattr( module, function_name )()
  except Exception:
    LOGGER.exception(
      'Error occurred while calling global extra conf method %s '
      'on conf file %s', function_name, global_ycm_extra_conf )
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:30,代碼來源:extra_conf_store.py

示例6: _CurrentLine

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
 def _CurrentLine( self ):
   try:
     return self[ 'lines' ][ self[ 'line_num' ] - 1 ]
   except IndexError:
     LOGGER.exception( 'Client returned invalid line number %s '
                       'for file %s. Assuming empty',
                       self[ 'line_num' ],
                       self[ 'filepath' ] )
     return ''
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:11,代碼來源:request_wrap.py

示例7: _GetDoc

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _GetDoc( self, request_data ):
    try:
      definition = self._GetResponse( '/find_definition',
                                      request_data )

      docs = [ definition[ 'context' ], definition[ 'docs' ] ]
      return responses.BuildDetailedInfoResponse( '\n---\n'.join( docs ) )
    except Exception:
      LOGGER.exception( 'Failed to find definition' )
      raise RuntimeError( 'Can\'t lookup docs.' )
開發者ID:Valloric,項目名稱:ycmd,代碼行數:12,代碼來源:rust_completer.py

示例8: _GoToDefinition

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
 def _GoToDefinition( self, request_data ):
   try:
     definition = self._GetResponse( '/find_definition',
                                     request_data )
     return responses.BuildGoToResponse( definition[ 'file_path' ],
                                         definition[ 'line' ],
                                         definition[ 'column' ] + 1 )
   except Exception:
     LOGGER.exception( 'Failed to find definition' )
     raise RuntimeError( 'Can\'t jump to definition.' )
開發者ID:Valloric,項目名稱:ycmd,代碼行數:12,代碼來源:rust_completer.py

示例9: _GoTo

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _GoTo( self, request_data ):
    try:
      return self._GoToDefinition( request_data )
    except Exception:
      LOGGER.exception( 'Failed to jump to definition' )

    try:
      return self._GoToDeclaration( request_data )
    except Exception:
      LOGGER.exception( 'Failed to jump to declaration' )
      raise RuntimeError( 'Can\'t jump to definition or declaration.' )
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:13,代碼來源:python_completer.py

示例10: _WriteRequest

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _WriteRequest( self, request ):
    """Write a request to TSServer stdin."""

    serialized_request = utils.ToBytes( json.dumps( request ) + '\n' )
    with self._write_lock:
      try:
        self._tsserver_handle.stdin.write( serialized_request )
        self._tsserver_handle.stdin.flush()
      # IOError is an alias of OSError in Python 3.
      except ( AttributeError, IOError ):
        LOGGER.exception( SERVER_NOT_RUNNING_MESSAGE )
        raise RuntimeError( SERVER_NOT_RUNNING_MESSAGE )
開發者ID:christophermca,項目名稱:dotfiles,代碼行數:14,代碼來源:typescript_completer.py

示例11: _StopServer

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _StopServer( self ):
    with self._server_state_lock:
      if self._racerd_phandle:
        LOGGER.info( 'Stopping Racerd with PID %s', self._racerd_phandle.pid )
        self._racerd_phandle.terminate()
        try:
          utils.WaitUntilProcessIsTerminated( self._racerd_phandle,
                                              timeout = 5 )
          LOGGER.info( 'Racerd stopped' )
        except RuntimeError:
          LOGGER.exception( 'Error while stopping Racerd' )

      self._CleanUp()
開發者ID:Valloric,項目名稱:ycmd,代碼行數:15,代碼來源:rust_completer.py

示例12: _StopServer

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _StopServer( self ):
    with self._tsserver_lock:
      if self._ServerIsRunning():
        LOGGER.info( 'Stopping TSServer with PID %s',
                     self._tsserver_handle.pid )
        try:
          self._SendCommand( 'exit' )
          utils.WaitUntilProcessIsTerminated( self._tsserver_handle,
                                              timeout = 5 )
          LOGGER.info( 'TSServer stopped' )
        except Exception:
          LOGGER.exception( 'Error while stopping TSServer' )

      self._CleanUp()
開發者ID:christophermca,項目名稱:dotfiles,代碼行數:16,代碼來源:typescript_completer.py

示例13: _StopServer

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _StopServer( self ):
    with self._server_state_mutex:
      if self._ServerIsRunning():
        LOGGER.info( 'Stopping Tern server with PID %s',
                     self._server_handle.pid )
        self._server_handle.terminate()
        try:
          utils.WaitUntilProcessIsTerminated( self._server_handle,
                                              timeout = 5 )
          LOGGER.info( 'Tern server stopped' )
        except RuntimeError:
          LOGGER.exception( 'Error while stopping Tern server' )

      self._CleanUp()
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:16,代碼來源:tern_completer.py

示例14: _StopServer

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
  def _StopServer( self ):
    """ Stop the OmniSharp server using a lock. """
    with self._server_state_lock:
      if self._ServerIsRunning():
        LOGGER.info( 'Stopping OmniSharp server with PID %s',
                     self._omnisharp_phandle.pid )
        try:
          self._GetResponse( '/stopserver' )
          utils.WaitUntilProcessIsTerminated( self._omnisharp_phandle,
                                              timeout = 5 )
          LOGGER.info( 'OmniSharp server stopped' )
        except Exception:
          LOGGER.exception( 'Error while stopping OmniSharp server' )

      self._CleanUp()
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:17,代碼來源:cs_completer.py

示例15: GetFileContents

# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import exception [as 別名]
def GetFileContents( request_data, filename ):
  """Returns the contents of the absolute path |filename| as a unicode
  string. If the file contents exist in |request_data| (i.e. it is open and
  potentially modified/dirty in the user's editor), then it is returned,
  otherwise the file is read from disk (assuming a UTF-8 encoding) and its
  contents returned."""
  file_data = request_data[ 'file_data' ]
  if filename in file_data:
    return ToUnicode( file_data[ filename ][ 'contents' ] )

  try:
    return ToUnicode( ReadFile( filename ) )
  except IOError:
    LOGGER.exception( 'Error reading file %s', filename )
    return ''
開發者ID:SolaWing,項目名稱:ycmd,代碼行數:17,代碼來源:completer_utils.py


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