本文整理匯總了Python中ycmd.utils.LOGGER類的典型用法代碼示例。如果您正苦於以下問題:Python LOGGER類的具體用法?Python LOGGER怎麽用?Python LOGGER使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了LOGGER類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _StartServer
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
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: FindRacerdBinary
def FindRacerdBinary( user_options ):
"""
Find path to racerd binary
This function prefers the 'racerd_binary_path' value as provided in
user_options if available. It then falls back to ycmd's racerd build. If
that's not found, attempts to use racerd from current path.
"""
racerd_user_binary = user_options.get( 'racerd_binary_path' )
if racerd_user_binary:
# The user has explicitly specified a path.
if os.path.isfile( racerd_user_binary ):
return racerd_user_binary
LOGGER.warning( 'User-provided racerd_binary_path does not exist' )
if os.path.isfile( RACERD_BINARY_RELEASE ):
return RACERD_BINARY_RELEASE
# We want to support using the debug binary for the sake of debugging; also,
# building the release version on Travis takes too long.
if os.path.isfile( RACERD_BINARY_DEBUG ):
LOGGER.warning( 'Using racerd DEBUG binary; performance will suffer!' )
return RACERD_BINARY_DEBUG
return utils.PathToFirstExistingExecutable( [ 'racerd' ] )
示例4: FiletypeCompletionAvailable
def FiletypeCompletionAvailable( self, filetypes ):
try:
self.GetFiletypeCompleter( filetypes )
return True
except Exception:
LOGGER.exception( 'Semantic completion not available for %s', filetypes )
return False
示例5: GetReady
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 )
示例6: _CleanUp
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()
示例7: _ChooseOmnisharpPort
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 )
示例8: ShouldEnableTypeScriptCompleter
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
示例9: Keepalive
def Keepalive( check_interval_seconds ):
while True:
time.sleep( check_interval_seconds )
LOGGER.debug( 'Keeping subservers alive' )
loaded_completers = _server_state.GetLoadedFiletypeCompleters()
for completer in loaded_completers:
completer.ServerIsHealthy()
示例10: RunCompleterCommand
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: _RestartServer
def _RestartServer( self ):
LOGGER.debug( 'Restarting racerd' )
with self._server_state_lock:
if self._ServerIsRunning():
self._StopServer()
self._StartServer()
LOGGER.debug( 'Racerd restarted' )
示例12: _CurrentLine
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 ''
示例13: _GetDoc
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.' )
示例14: _GoToDefinition
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.' )
示例15: _GoTo
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.' )