Skip to content

Commit

Permalink
Merge pull request #12 from pope/master
Browse files Browse the repository at this point in the history
Log the output of the Ycmd auto-server
  • Loading branch information
LuckyGeck committed Nov 23, 2015
2 parents c4c8d73 + 6110581 commit aea9fb2
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion ycmd/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import socket
import subprocess
import tempfile
import threading


HMAC_HEADER = 'X-Ycm-Hmac'
Expand Down Expand Up @@ -49,7 +50,12 @@ def StartYcmdAndReturnHandle(cls, python_path, ycmd_path, default_settings_path)
'--port={0}'.format(server_port),
'--options_file={0}'.format(options_file.name),
'--idle_suicide_seconds={0}'.format(3600)]
child_handle = subprocess.Popen(ycmd_args)
child_handle = subprocess.Popen(ycmd_args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
t = threading.Thread(target=LogServerOutput, args=[child_handle.stdout])
t.daemon = True
t.start()
return cls(child_handle, "http://localhost", server_port, hmac_secret)

@classmethod
Expand Down Expand Up @@ -197,6 +203,12 @@ def CppSemanticCompletionResults(server, path, row, col, contents, filetype='cpp
column_num=col,
contents=contents)

def LogServerOutput(stdout):
for line in iter(stdout.readline, b''):
s = line.decode('utf-8').rstrip()
print('[Ycmd][Server] {}'.format(s))
stdout.close()


def GetUnusedLocalhostPort():
sock = socket.socket()
Expand Down

0 comments on commit aea9fb2

Please sign in to comment.