Skip to content

Commit c0cf9ae

Browse files
committed
#1018 cleanup logs
1 parent 8422502 commit c0cf9ae

File tree

12 files changed

+45
-46
lines changed

12 files changed

+45
-46
lines changed

main.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ if LOGLEVEL then
6363
end
6464

6565
log.info('Lua Lsp startup, root: ', ROOT)
66-
log.debug('ROOT:', ROOT:string())
67-
log.debug('LOGPATH:', LOGPATH)
68-
log.debug('METAPATH:', METAPATH)
69-
log.debug('VERSION:', version.getVersion())
66+
log.info('ROOT:', ROOT:string())
67+
log.info('LOGPATH:', LOGPATH)
68+
log.info('METAPATH:', METAPATH)
69+
log.info('VERSION:', version.getVersion())
7070

7171
require 'tracy'
7272
require 'cli'

script/await.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ function m.stop()
185185
end
186186

187187
local function warnStepTime(passed, waker)
188-
if passed < 1 then
188+
if passed < 2 then
189189
log.warn(('Await step takes [%.3f] sec.'):format(passed))
190190
return
191191
end
@@ -215,7 +215,7 @@ function m.step()
215215
local clock = os.clock()
216216
resume()
217217
local passed = os.clock() - clock
218-
if passed > 0.1 then
218+
if passed > 0.5 then
219219
warnStepTime(passed, resume)
220220
end
221221
return true

script/library.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ local function initBuiltIn(uri)
220220
end
221221

222222
if scp:get('metaPath') == metaPath:string() then
223-
log.info('Has meta path, skip:', metaPath:string())
223+
log.debug('Has meta path, skip:', metaPath:string())
224224
return
225225
end
226226
scp:set('metaPath', metaPath:string())
@@ -230,14 +230,14 @@ local function initBuiltIn(uri)
230230
end
231231
end, log.error)
232232
if not suc then
233-
log.info('Init builtin failed.')
233+
log.warn('Init builtin failed.')
234234
return
235235
end
236236
local out = fsu.dummyFS()
237237
local templateDir = ROOT / 'meta' / 'template'
238238
for libName, status in pairs(define.BuiltIn) do
239239
status = config.get(uri, 'Lua.runtime.builtin')[libName] or status
240-
log.info('Builtin status:', libName, status)
240+
log.debug('Builtin status:', libName, status)
241241
if status == 'disable' then
242242
goto CONTINUE
243243
end
@@ -249,7 +249,7 @@ local function initBuiltIn(uri)
249249
out:saveFile(libName, metaDoc)
250250
local outputPath = metaPath / libName
251251
m.metaPaths[outputPath:string()] = true
252-
log.info('Meta path:', outputPath:string())
252+
log.debug('Meta path:', outputPath:string())
253253
end
254254
::CONTINUE::
255255
end

script/proto/proto.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ local function logSend(buf)
1212
if not RPCLOG then
1313
return
1414
end
15-
log.debug('rpc send:', buf)
15+
log.info('rpc send:', buf)
1616
end
1717

1818
local function logRecieve(proto)
1919
if not RPCLOG then
2020
return
2121
end
22-
log.debug('rpc recieve:', json.encode(proto))
22+
log.info('rpc recieve:', json.encode(proto))
2323
end
2424

2525
local m = {}
@@ -167,8 +167,8 @@ function m.doMethod(proto)
167167
-- 任务可能在执行过程中被中断,通过close来捕获
168168
local response <close> = function ()
169169
local passed = os.clock() - clock
170-
if passed > 0.2 then
171-
log.debug(('Method [%s] takes [%.3f]sec. %s'):format(method, passed, util.dump(proto, secretOption)))
170+
if passed > 0.5 then
171+
log.warn(('Method [%s] takes [%.3f]sec. %s'):format(method, passed, util.dump(proto, secretOption)))
172172
end
173173
--log.debug('Finish method:', method)
174174
if not proto.id then

script/provider/completion.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ local function enable(uri)
4040
end
4141
nonil.disable()
4242
isEnable = true
43-
log.debug('Enable completion.')
43+
log.info('Enable completion.')
4444
proto.request('client/registerCapability', {
4545
registrations = {
4646
{
@@ -66,7 +66,7 @@ local function disable(uri)
6666
end
6767
nonil.disable()
6868
isEnable = false
69-
log.debug('Disable completion.')
69+
log.info('Disable completion.')
7070
proto.request('client/unregisterCapability', {
7171
unregisterations = {
7272
{

script/provider/diagnostic.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ function m.clear(uri)
141141
uri = uri,
142142
diagnostics = {},
143143
})
144-
log.debug('clearDiagnostics', uri)
144+
log.info('clearDiagnostics', uri)
145145
end
146146

147147
function m.clearCache(uri)
@@ -370,7 +370,7 @@ function m.awaitDiagnosticsScope(suri)
370370
local bar <close> = progress.create(scope.getScope(suri), lang.script.WORKSPACE_DIAGNOSTIC, 1)
371371
local cancelled
372372
bar:onCancel(function ()
373-
log.debug('Cancel workspace diagnostics')
373+
log.info('Cancel workspace diagnostics')
374374
cancelled = true
375375
---@async
376376
await.call(function ()
@@ -398,12 +398,12 @@ function m.awaitDiagnosticsScope(suri)
398398
xpcall(m.doDiagnostic, log.error, uri, true)
399399
await.delay()
400400
if cancelled then
401-
log.debug('Break workspace diagnostics')
401+
log.info('Break workspace diagnostics')
402402
break
403403
end
404404
end
405405
bar:remove()
406-
log.debug(('Diagnostics scope [%s] finished, takes [%.3f] sec.'):format(scp:getName(), os.clock() - clock))
406+
log.info(('Diagnostics scope [%s] finished, takes [%.3f] sec.'):format(scp:getName(), os.clock() - clock))
407407
end
408408

409409
function m.diagnosticsScope(uri, force)

script/provider/provider.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ local function updateConfig(uri)
2424
config.addNullSymbol(json.null)
2525
local specified = cfgLoader.loadLocalConfig(uri, CONFIGPATH)
2626
if specified then
27-
log.debug('Load config from specified', CONFIGPATH)
27+
log.info('Load config from specified', CONFIGPATH)
2828
log.debug(util.dump(specified))
2929
-- watch directory
3030
filewatch.watch(workspace.getAbsolutePath(uri, CONFIGPATH):gsub('[^/\\]+$', ''))
@@ -34,21 +34,21 @@ local function updateConfig(uri)
3434
for _, folder in ipairs(scope.folders) do
3535
local clientConfig = cfgLoader.loadClientConfig(folder.uri)
3636
if clientConfig then
37-
log.debug('Load config from client', folder.uri)
37+
log.info('Load config from client', folder.uri)
3838
log.debug(util.dump(clientConfig))
3939
end
4040

4141
local rc = cfgLoader.loadRCConfig(folder.uri, '.luarc.json')
4242
if rc then
43-
log.debug('Load config from luarc.json', folder.uri)
43+
log.info('Load config from luarc.json', folder.uri)
4444
log.debug(util.dump(rc))
4545
end
4646

4747
config.update(folder, clientConfig, rc)
4848
end
4949

5050
local global = cfgLoader.loadClientConfig()
51-
log.debug('Load config from client', 'fallback')
51+
log.info('Load config from client', 'fallback')
5252
log.debug(util.dump(global))
5353
config.update(scope.fallback, global)
5454
end

script/pub/pub.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ end
4545
function m.recruitBraves(num)
4646
for _ = 1, num do
4747
local id = #m.braves + 1
48-
log.info('Create brave:', id)
48+
log.debug('Create brave:', id)
4949
m.braves[id] = {
5050
id = id,
5151
thread = thread.thread(braveTemplate:format(

script/service/service.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ function m.reportProto()
128128
end
129129

130130
function m.report()
131-
local t = timer.loop(60.0, function ()
131+
local t = timer.loop(600.0, function ()
132132
local lines = {}
133133
lines[#lines+1] = ''
134134
lines[#lines+1] = '========= Medical Examination Report ========='
@@ -138,7 +138,7 @@ function m.report()
138138
lines[#lines+1] = m.reportProto()
139139
lines[#lines+1] = '=============================================='
140140

141-
log.debug(table.concat(lines, '\n'))
141+
log.info(table.concat(lines, '\n'))
142142
end)
143143
t:onTimer()
144144
end

script/service/telemetry.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if not token then
1919
util.saveFile(tokenPath, token)
2020
end
2121

22-
log.info('Telemetry Token:', token)
22+
log.debug('Telemetry Token:', token)
2323

2424
local function getClientName()
2525
nonil.enable()

0 commit comments

Comments
 (0)