本文整理匯總了Python中ycmd.utils.LOGGER.info方法的典型用法代碼示例。如果您正苦於以下問題:Python LOGGER.info方法的具體用法?Python LOGGER.info怎麽用?Python LOGGER.info使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ycmd.utils.LOGGER
的用法示例。
在下文中一共展示了LOGGER.info方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _StartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def _StartServer( self ):
with self._tsserver_lock:
if self._ServerIsRunning():
return
self._logfile = utils.CreateLogfile( LOGFILE_FORMAT )
tsserver_log = '-file {path} -level {level}'.format( path = self._logfile,
level = _LogLevel() )
# TSServer gets the configuration for the log file through the
# environment variable 'TSS_LOG'. This seems to be undocumented but
# looking at the source code it seems like this is the way:
# https://github.com/Microsoft/TypeScript/blob/8a93b489454fdcbdf544edef05f73a913449be1d/src/server/server.ts#L136
environ = os.environ.copy()
utils.SetEnviron( environ, 'TSS_LOG', tsserver_log )
LOGGER.info( 'TSServer log file: %s', self._logfile )
# We need to redirect the error stream to the output one on Windows.
self._tsserver_handle = utils.SafePopen( self._tsserver_executable,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
env = environ )
self._tsserver_is_running.set()
utils.StartThread( self._SetServerVersion )
示例2: _CallGlobalExtraConfMethod
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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 )
示例3: _ReaderLoop
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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 ]
示例4: GetReady
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def GetReady():
LOGGER.info( 'Received ready request' )
if request.query.subserver:
filetype = request.query.subserver
completer = _server_state.GetFiletypeCompleter( [ filetype ] )
return _JsonResponse( completer.ServerIsReady() )
return _JsonResponse( True )
示例5: StartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例6: GetClangdExecutableAndResourceDir
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例7: PollModule
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例8: _ChooseOmnisharpPort
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def _ChooseOmnisharpPort( self ):
if not self._omnisharp_port:
if self._desired_omnisharp_port:
self._omnisharp_port = int( self._desired_omnisharp_port )
else:
self._omnisharp_port = utils.GetUnusedLocalhostPort()
LOGGER.info( 'using port %s', self._omnisharp_port )
示例9: ShouldEnableTypeScriptCompleter
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例10: RunCompleterCommand
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def RunCompleterCommand():
LOGGER.info( 'Received command request' )
request_data = RequestWrap( request.json )
completer = _GetCompleterForRequestData( request_data )
return _JsonResponse( completer.OnUserCommand(
request_data[ 'command_arguments' ],
request_data ) )
示例11: StartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例12: GetThirdPartyClangd
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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
示例13: FilterAndSortCandidates
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def FilterAndSortCandidates():
LOGGER.info( 'Received filter & sort request' )
# Not using RequestWrap because no need and the requests coming in aren't like
# the usual requests we handle.
request_data = request.json
return _JsonResponse( FilterAndSortCandidatesWrap(
request_data[ 'candidates' ],
request_data[ 'sort_property' ],
request_data[ 'query' ],
_server_state.user_options[ 'max_num_candidates' ] ) )
示例14: HandleNotificationInPollThread
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [as 別名]
def HandleNotificationInPollThread( self, notification ):
if notification[ 'method' ] == 'language/status':
message_type = notification[ 'params' ][ 'type' ]
if message_type == 'Started':
LOGGER.info( 'jdt.ls initialized successfully' )
self._server_init_status = notification[ 'params' ][ 'message' ]
self._received_ready_message.set()
elif not self._received_ready_message.is_set():
self._server_init_status = notification[ 'params' ][ 'message' ]
super( JavaCompleter, self ).HandleNotificationInPollThread( notification )
示例15: _StopServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import info [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()