本文整理匯總了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 ]
示例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
示例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
示例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
示例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
示例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
示例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
示例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 )
示例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
示例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()