Log code completion data in json format.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101587 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/utils/CIndex/completion_logger_server.py b/utils/CIndex/completion_logger_server.py
index 3182c1c..759c79b 100755
--- a/utils/CIndex/completion_logger_server.py
+++ b/utils/CIndex/completion_logger_server.py
@@ -1,7 +1,8 @@
#!/usr/bin/env python
import sys
from socket import *
-from time import localtime, strftime
+from time import strftime
+import datetime
def main():
if len(sys.argv) < 4:
@@ -28,10 +29,12 @@
if not data:
break
else:
- f.write(strftime("'%a, %d %b %Y %H:%M:%S' ", localtime()))
- f.write("'{0}' ".format(addr[0]))
+ f.write("{ ");
+ f.write("\"time\": \"{0}\"".format(datetime.utcnow().strftime('%Y-%m-%d %H:%M:%S')))
+ f.write(", \"sender\": \"{0}\" ".format(addr[0]))
+ f.write(", data: ")
f.write(data)
- f.write('\n')
+ f.write(" }\n")
f.flush()
# Close socket