本文整理匯總了Python中ycmd.utils.LOGGER.debug方法的典型用法代碼示例。如果您正苦於以下問題:Python LOGGER.debug方法的具體用法?Python LOGGER.debug怎麽用?Python LOGGER.debug使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ycmd.utils.LOGGER
的用法示例。
在下文中一共展示了LOGGER.debug方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _CallGlobalExtraConfMethod
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [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 )
示例2: Keepalive
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
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()
示例3: _RestartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _RestartServer( self ):
LOGGER.debug( 'Restarting racerd' )
with self._server_state_lock:
if self._ServerIsRunning():
self._StopServer()
self._StartServer()
LOGGER.debug( 'Racerd restarted' )
示例4: StartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [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
示例5: _StartServer
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _StartServer( self, request_data ):
with self._server_state_mutex:
if self._server_started:
return
self._server_started = True
LOGGER.info( 'Starting Tern server...' )
self._SetServerProjectFileAndWorkingDirectory( request_data )
self._server_port = utils.GetUnusedLocalhostPort()
command = [ PATH_TO_NODE,
PATH_TO_TERN_BINARY,
'--port',
str( self._server_port ),
'--host',
SERVER_HOST,
'--persistent',
'--no-port-file' ]
if LOGGER.isEnabledFor( logging.DEBUG ):
command.append( '--verbose' )
LOGGER.debug( 'Starting tern with the following command: %s', command )
self._server_stdout = utils.CreateLogfile(
LOGFILE_FORMAT.format( port = self._server_port, std = 'stdout' ) )
self._server_stderr = utils.CreateLogfile(
LOGFILE_FORMAT.format( port = self._server_port, std = 'stderr' ) )
# We need to open a pipe to stdin or the Tern server is killed.
# See https://github.com/ternjs/tern/issues/740#issuecomment-203979749
# For unknown reasons, this is only needed on Windows and for Python
# 3.4+ on other platforms.
with utils.OpenForStdHandle( self._server_stdout ) as stdout:
with utils.OpenForStdHandle( self._server_stderr ) as stderr:
self._server_handle = utils.SafePopen(
command,
stdin = PIPE,
stdout = stdout,
stderr = stderr,
cwd = self._server_working_dir )
if self._ServerIsRunning():
LOGGER.info( 'Tern Server started with pid %d listening on port %d',
self._server_handle.pid, self._server_port )
LOGGER.info( 'Tern Server log files are %s and %s',
self._server_stdout, self._server_stderr )
self._do_tern_project_check = True
else:
LOGGER.warning( 'Tern server did not start successfully' )
示例6: _GetSettings
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _GetSettings( self, module, client_data ):
# We don't warn the user if no extra conf file is found.
if module:
if hasattr( module, 'Settings' ):
settings = module.Settings( language = 'python',
client_data = client_data )
if settings is not None:
return settings
LOGGER.debug( 'No Settings function defined in %s', module.__file__ )
return {
# NOTE: this option is only kept for backward compatibility. Setting the
# Python interpreter path through the extra conf file is preferred.
'interpreter_path': self.user_options[ 'python_binary_path' ]
}
示例7: _GetSysPath
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _GetSysPath( self, request_data, environment ):
settings = {
'sys_path': []
}
settings.update( self._SettingsForRequest( request_data ) )
settings[ 'interpreter_path' ] = environment.executable
settings[ 'sys_path' ].extend( environment.get_sys_path() )
filepath = request_data[ 'filepath' ]
module = extra_conf_store.ModuleForSourceFile( filepath )
# We don't warn the user if no extra conf file is found.
if module:
if hasattr( module, 'PythonSysPath' ):
return module.PythonSysPath( **settings )
LOGGER.debug( 'No PythonSysPath function defined in %s', module.__file__ )
return settings[ 'sys_path' ]
示例8: ServerIsHealthy
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def ServerIsHealthy( self ):
"""
Check if racerd is alive AND ready to serve requests.
"""
if not self._ServerIsRunning():
LOGGER.debug( 'Racerd not running' )
return False
try:
self._GetResponse( '/ping', method = 'GET' )
return True
# Do NOT make this except clause more generic! If you need to catch more
# exception types, list them all out. Having `Exception` here caused FORTY
# HOURS OF DEBUGGING.
except requests.exceptions.ConnectionError:
LOGGER.exception( 'Failed to connect to racerd' )
return False
示例9: _PathToLauncherJar
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _PathToLauncherJar():
# The file name changes between version of eclipse, so we use a glob as
# recommended by the language server developers. There should only be one.
launcher_jars = glob.glob(
os.path.abspath(
os.path.join(
LANGUAGE_SERVER_HOME,
'plugins',
'org.eclipse.equinox.launcher_*.jar' ) ) )
LOGGER.debug( 'Found launchers: %s', launcher_jars )
if not launcher_jars:
return None
return launcher_jars[ 0 ]
示例10: EventNotification
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def EventNotification():
LOGGER.info( 'Received event notification' )
request_data = RequestWrap( request.json )
event_name = request_data[ 'event_name' ]
LOGGER.debug( 'Event name: %s', event_name )
event_handler = 'On' + event_name
getattr( _server_state.GetGeneralCompleter(), event_handler )( request_data )
filetypes = request_data[ 'filetypes' ]
response_data = None
if _server_state.FiletypeCompletionUsable( filetypes ):
response_data = getattr( _server_state.GetFiletypeCompleter( filetypes ),
event_handler )( request_data )
if response_data:
return _JsonResponse( response_data )
return _JsonResponse( {} )
示例11: _FindProjectDir
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _FindProjectDir( starting_dir ):
project_path = starting_dir
project_type = None
for folder in utils.PathsToAllParentFolders( starting_dir ):
for project_file, tail in _MakeProjectFilesForPath( folder ):
if os.path.isfile( project_file ):
project_path = folder
project_type = tail
break
if project_type:
break
if project_type:
# We've found a project marker file (like build.gradle). Search parent
# directories for that same project type file and find the topmost one as
# the project root.
LOGGER.debug( 'Found %s style project in %s. Searching for '
'project root:', project_type, project_path )
for folder in utils.PathsToAllParentFolders( os.path.join( project_path,
'..' ) ):
if os.path.isfile( os.path.join( folder, project_type ) ):
LOGGER.debug( ' %s is a parent project dir', folder )
project_path = folder
else:
break
LOGGER.debug( ' Project root is %s', project_path )
return project_path
示例12: GetCompletions
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def GetCompletions():
LOGGER.info( 'Received completion request' )
request_data = RequestWrap( request.json )
do_filetype_completion = _server_state.ShouldUseFiletypeCompleter(
request_data )
LOGGER.debug( 'Using filetype completion: %s', do_filetype_completion )
errors = None
completions = None
if do_filetype_completion:
try:
completions = ( _server_state.GetFiletypeCompleter(
request_data[ 'filetypes' ] )
.ComputeCandidates( request_data ) )
except Exception as exception:
if request_data[ 'force_semantic' ]:
# user explicitly asked for semantic completion, so just pass the error
# back
raise
# store the error to be returned with results from the identifier
# completer
LOGGER.exception( 'Exception from semantic completer (using general)' )
stack = traceback.format_exc()
errors = [ BuildExceptionResponse( exception, stack ) ]
if not completions and not request_data[ 'force_semantic' ]:
completions = _server_state.GetGeneralCompleter().ComputeCandidates(
request_data )
return _JsonResponse(
BuildCompletionResponse( completions if completions else [],
request_data[ 'start_column' ],
errors = errors ) )
示例13: _GetResponse
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def _GetResponse( self, handler, request_data = None,
method = 'POST' ):
"""
Query racerd via HTTP
racerd returns JSON with 200 OK responses. 204 No Content responses occur
when no errors were encountered but no completions, definitions, or errors
were found.
"""
handler = ToBytes( handler )
method = ToBytes( method )
url = urljoin( ToBytes( self._racerd_host ), handler )
parameters = self._ConvertToRacerdRequest( request_data )
body = ToBytes( json.dumps( parameters ) ) if parameters else bytes()
extra_headers = self._ExtraHeaders( method, handler, body )
LOGGER.debug( 'Making racerd request: %s %s %s %s',
method,
url,
extra_headers,
body )
# Failing to wrap the method & url bytes objects in `native()` causes HMAC
# failures (403 Forbidden from racerd) for unknown reasons. Similar for
# request_hmac above.
response = requests.request( native( method ),
native( url ),
data = body,
headers = extra_headers )
response.raise_for_status()
if response.status_code == requests.codes.no_content:
return None
return response.json()
示例14: Shutdown
# 需要導入模塊: from ycmd.utils import LOGGER [as 別名]
# 或者: from ycmd.utils.LOGGER import debug [as 別名]
def Shutdown( self ):
LOGGER.debug( 'Shutting down Tern server' )
self._StopServer()