Skip to content

Commit

Permalink
Auto merge of #513 - micbou:python-completer-log-level, r=Valloric
Browse files Browse the repository at this point in the history
[READY] Pass ycmd logging level to JediHTTP

Now that [`JediHTTP` has an option to set its logging level](vheon/JediHTTP#15), we can pass `ycmd` logging level to it.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/valloric/ycmd/513)
<!-- Reviewable:end -->
  • Loading branch information
homu committed Jun 3, 2016
2 parents d2b9873 + cfdb56e commit 47304e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion third_party/JediHTTP
8 changes: 8 additions & 0 deletions ycmd/completers/python/jedi_completer.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def _StartServer( self ):
command = [ self._python_binary_path,
PATH_TO_JEDIHTTP,
'--port', str( self._jedihttp_port ),
'--log', self._GetLoggingLevel(),
'--hmac-file-secret', hmac_file.name ]

self._logfile_stdout = LOG_FILENAME_FORMAT.format(
Expand All @@ -180,6 +181,13 @@ def _GenerateHmacSecret( self ):
return os.urandom( HMAC_SECRET_LENGTH )


def _GetLoggingLevel( self ):
# Tests are run with the NOTSET logging level but JediHTTP only accepts the
# predefined levels above (DEBUG, INFO, WARNING, etc.).
log_level = max( self._logger.getEffectiveLevel(), logging.DEBUG )
return logging.getLevelName( log_level ).lower()


def _GetResponse( self, handler, request_data = {} ):
"""POST JSON data to JediHTTP server and return JSON response."""
handler = ToBytes( handler )
Expand Down

0 comments on commit 47304e1

Please sign in to comment.