diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2020-12-15 15:08:03 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2020-12-15 15:08:03 +0800 |
commit | 930096359e8d1015c5e4aa0115de1679353b8b88 (patch) | |
tree | dcfcb38ad9c70c5bd4673de3f35343f43eada433 /script/service | |
parent | 20ea3b46f4356d9bf14d45bf80f8f47319843323 (diff) | |
download | lua-language-server-930096359e8d1015c5e4aa0115de1679353b8b88.zip |
push error log
Diffstat (limited to 'script/service')
-rw-r--r-- | script/service/telemetry.lua | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index 08c34314..82a9199e 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -14,15 +14,33 @@ end log.info('Telemetry Token:', token) -local function pushClientInfo(link) +local function getClientName() nonil.enable() local clientName = client.info.clientInfo.name local clientVersion = client.info.clientInfo.version nonil.disable() + return table.concat({clientName, clientVersion}, ' ') +end + +local function pushClientInfo(link) link:write(string.pack('zzz' , 'pulse' , token - , table.concat({clientName, clientVersion}, ' ') + , getClientName() + )) +end + +local function pushErrorLog(link) + if not log.firstError then + return + end + local err = log.firstError + log.firstError = nil + link:write(string.pack('zzzz' + , 'error' + , token + , getClientName() + , ('%q'):format(err) )) end @@ -33,6 +51,7 @@ timer.wait(5, function () end local link = net.connect('tcp', '119.45.194.183', 11577) pushClientInfo(link) + pushErrorLog(link) end)() timer.loop(1, function () if not config.config.telemetry.enable then |