summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-18 21:24:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-18 21:24:08 +0800
commit140dc03da4d8edb97a61e5ef45e92d391420fc39 (patch)
tree6952a853137be6498af80f23e5f2e4d1b489c994
parent769485b635de8b5ea0e37a25d4c8bc63cb256419 (diff)
downloadlua-language-server-140dc03da4d8edb97a61e5ef45e92d391420fc39.zip
print log
-rw-r--r--script/core/diagnostics/init.lua4
-rw-r--r--script/library.lua1
-rw-r--r--script/log.lua8
-rw-r--r--test.lua5
4 files changed, 10 insertions, 8 deletions
diff --git a/script/core/diagnostics/init.lua b/script/core/diagnostics/init.lua
index 32375a3a..562b526d 100644
--- a/script/core/diagnostics/init.lua
+++ b/script/core/diagnostics/init.lua
@@ -109,10 +109,6 @@ return function (uri, isScopeDiag, response, checked)
return nil
end
- if TEST then
- log.debug('do diagnostic @', uri)
- end
-
for _, name in ipairs(diagList) do
await.delay()
check(uri, name, isScopeDiag, response)
diff --git a/script/library.lua b/script/library.lua
index a4f14514..32eaea8e 100644
--- a/script/library.lua
+++ b/script/library.lua
@@ -201,6 +201,7 @@ local function loadMetaLocale(langID, result)
end
local function initBuiltIn(uri)
+ log.info('Init builtin library at:', uri)
local scp = ws.getScope(uri)
local langID = lang.id
local version = config.get(uri, 'Lua.runtime.version')
diff --git a/script/log.lua b/script/log.lua
index 90de895a..507051ae 100644
--- a/script/log.lua
+++ b/script/log.lua
@@ -55,7 +55,13 @@ local function pushLog(level, ...)
str = str .. '\n' .. debugTraceBack(nil, 3)
end
local info = debugGetInfo(3, 'Sl')
- return m.raw(0, level, str, info.source, info.currentline, monotonic())
+ local text = m.raw(0, level, str, info.source, info.currentline, monotonic())
+
+ if log.print then
+ print(text)
+ end
+
+ return text
end
function m.info(...)
diff --git a/test.lua b/test.lua
index d01077e4..eae21de7 100644
--- a/test.lua
+++ b/test.lua
@@ -77,7 +77,7 @@ local function main()
local lclient = require 'tclient.lclient'
local ws = require 'workspace'
- log.info = print
+ log.print = true
for _, os in ipairs {'Windows', 'Linux', 'macOS'} do
require 'bee.platform'.OS = os
@@ -100,12 +100,11 @@ local function main()
test 'tclient'
test 'full'
- print('测试完成')
end
loadAllLibs()
main()
-log.debug('测试完成')
+log.debug('test finish.')
require 'bee.thread'.sleep(1)
os.exit()