diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-04-05 23:03:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-04-05 23:03:16 +0800 |
commit | c0cf9ae2835f9a19fe6a9af743ddd24be7c3a123 (patch) | |
tree | 503bec02eaffff462aa23f5cbb92af2983a6036c | |
parent | 8422502419f2a5138c2772aea60111fa7e9599aa (diff) | |
download | lua-language-server-c0cf9ae2835f9a19fe6a9af743ddd24be7c3a123.zip |
#1018 cleanup logs
-rw-r--r-- | main.lua | 8 | ||||
-rw-r--r-- | script/await.lua | 4 | ||||
-rw-r--r-- | script/library.lua | 8 | ||||
-rw-r--r-- | script/proto/proto.lua | 8 | ||||
-rw-r--r-- | script/provider/completion.lua | 4 | ||||
-rw-r--r-- | script/provider/diagnostic.lua | 8 | ||||
-rw-r--r-- | script/provider/provider.lua | 8 | ||||
-rw-r--r-- | script/pub/pub.lua | 2 | ||||
-rw-r--r-- | script/service/service.lua | 4 | ||||
-rw-r--r-- | script/service/telemetry.lua | 2 | ||||
-rw-r--r-- | script/workspace/loading.lua | 13 | ||||
-rw-r--r-- | script/workspace/workspace.lua | 22 |
12 files changed, 45 insertions, 46 deletions
@@ -63,10 +63,10 @@ if LOGLEVEL then end log.info('Lua Lsp startup, root: ', ROOT) -log.debug('ROOT:', ROOT:string()) -log.debug('LOGPATH:', LOGPATH) -log.debug('METAPATH:', METAPATH) -log.debug('VERSION:', version.getVersion()) +log.info('ROOT:', ROOT:string()) +log.info('LOGPATH:', LOGPATH) +log.info('METAPATH:', METAPATH) +log.info('VERSION:', version.getVersion()) require 'tracy' require 'cli' diff --git a/script/await.lua b/script/await.lua index 4fdab0a2..4fb81cd8 100644 --- a/script/await.lua +++ b/script/await.lua @@ -185,7 +185,7 @@ function m.stop() end local function warnStepTime(passed, waker) - if passed < 1 then + if passed < 2 then log.warn(('Await step takes [%.3f] sec.'):format(passed)) return end @@ -215,7 +215,7 @@ function m.step() local clock = os.clock() resume() local passed = os.clock() - clock - if passed > 0.1 then + if passed > 0.5 then warnStepTime(passed, resume) end return true diff --git a/script/library.lua b/script/library.lua index 501f70d4..adfd0955 100644 --- a/script/library.lua +++ b/script/library.lua @@ -220,7 +220,7 @@ local function initBuiltIn(uri) end if scp:get('metaPath') == metaPath:string() then - log.info('Has meta path, skip:', metaPath:string()) + log.debug('Has meta path, skip:', metaPath:string()) return end scp:set('metaPath', metaPath:string()) @@ -230,14 +230,14 @@ local function initBuiltIn(uri) end end, log.error) if not suc then - log.info('Init builtin failed.') + log.warn('Init builtin failed.') return end local out = fsu.dummyFS() local templateDir = ROOT / 'meta' / 'template' for libName, status in pairs(define.BuiltIn) do status = config.get(uri, 'Lua.runtime.builtin')[libName] or status - log.info('Builtin status:', libName, status) + log.debug('Builtin status:', libName, status) if status == 'disable' then goto CONTINUE end @@ -249,7 +249,7 @@ local function initBuiltIn(uri) out:saveFile(libName, metaDoc) local outputPath = metaPath / libName m.metaPaths[outputPath:string()] = true - log.info('Meta path:', outputPath:string()) + log.debug('Meta path:', outputPath:string()) end ::CONTINUE:: end diff --git a/script/proto/proto.lua b/script/proto/proto.lua index 83a188f9..cb549764 100644 --- a/script/proto/proto.lua +++ b/script/proto/proto.lua @@ -12,14 +12,14 @@ local function logSend(buf) if not RPCLOG then return end - log.debug('rpc send:', buf) + log.info('rpc send:', buf) end local function logRecieve(proto) if not RPCLOG then return end - log.debug('rpc recieve:', json.encode(proto)) + log.info('rpc recieve:', json.encode(proto)) end local m = {} @@ -167,8 +167,8 @@ function m.doMethod(proto) -- 任务可能在执行过程中被中断,通过close来捕获 local response <close> = function () local passed = os.clock() - clock - if passed > 0.2 then - log.debug(('Method [%s] takes [%.3f]sec. %s'):format(method, passed, util.dump(proto, secretOption))) + if passed > 0.5 then + log.warn(('Method [%s] takes [%.3f]sec. %s'):format(method, passed, util.dump(proto, secretOption))) end --log.debug('Finish method:', method) if not proto.id then diff --git a/script/provider/completion.lua b/script/provider/completion.lua index 7714525a..46960709 100644 --- a/script/provider/completion.lua +++ b/script/provider/completion.lua @@ -40,7 +40,7 @@ local function enable(uri) end nonil.disable() isEnable = true - log.debug('Enable completion.') + log.info('Enable completion.') proto.request('client/registerCapability', { registrations = { { @@ -66,7 +66,7 @@ local function disable(uri) end nonil.disable() isEnable = false - log.debug('Disable completion.') + log.info('Disable completion.') proto.request('client/unregisterCapability', { unregisterations = { { diff --git a/script/provider/diagnostic.lua b/script/provider/diagnostic.lua index ac93dc52..ef61d0c3 100644 --- a/script/provider/diagnostic.lua +++ b/script/provider/diagnostic.lua @@ -141,7 +141,7 @@ function m.clear(uri) uri = uri, diagnostics = {}, }) - log.debug('clearDiagnostics', uri) + log.info('clearDiagnostics', uri) end function m.clearCache(uri) @@ -370,7 +370,7 @@ function m.awaitDiagnosticsScope(suri) local bar <close> = progress.create(scope.getScope(suri), lang.script.WORKSPACE_DIAGNOSTIC, 1) local cancelled bar:onCancel(function () - log.debug('Cancel workspace diagnostics') + log.info('Cancel workspace diagnostics') cancelled = true ---@async await.call(function () @@ -398,12 +398,12 @@ function m.awaitDiagnosticsScope(suri) xpcall(m.doDiagnostic, log.error, uri, true) await.delay() if cancelled then - log.debug('Break workspace diagnostics') + log.info('Break workspace diagnostics') break end end bar:remove() - log.debug(('Diagnostics scope [%s] finished, takes [%.3f] sec.'):format(scp:getName(), os.clock() - clock)) + log.info(('Diagnostics scope [%s] finished, takes [%.3f] sec.'):format(scp:getName(), os.clock() - clock)) end function m.diagnosticsScope(uri, force) diff --git a/script/provider/provider.lua b/script/provider/provider.lua index eb4a274c..1904301d 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -24,7 +24,7 @@ local function updateConfig(uri) config.addNullSymbol(json.null) local specified = cfgLoader.loadLocalConfig(uri, CONFIGPATH) if specified then - log.debug('Load config from specified', CONFIGPATH) + log.info('Load config from specified', CONFIGPATH) log.debug(util.dump(specified)) -- watch directory filewatch.watch(workspace.getAbsolutePath(uri, CONFIGPATH):gsub('[^/\\]+$', '')) @@ -34,13 +34,13 @@ local function updateConfig(uri) for _, folder in ipairs(scope.folders) do local clientConfig = cfgLoader.loadClientConfig(folder.uri) if clientConfig then - log.debug('Load config from client', folder.uri) + log.info('Load config from client', folder.uri) log.debug(util.dump(clientConfig)) end local rc = cfgLoader.loadRCConfig(folder.uri, '.luarc.json') if rc then - log.debug('Load config from luarc.json', folder.uri) + log.info('Load config from luarc.json', folder.uri) log.debug(util.dump(rc)) end @@ -48,7 +48,7 @@ local function updateConfig(uri) end local global = cfgLoader.loadClientConfig() - log.debug('Load config from client', 'fallback') + log.info('Load config from client', 'fallback') log.debug(util.dump(global)) config.update(scope.fallback, global) end diff --git a/script/pub/pub.lua b/script/pub/pub.lua index 1b2dbcac..e73aea51 100644 --- a/script/pub/pub.lua +++ b/script/pub/pub.lua @@ -45,7 +45,7 @@ end function m.recruitBraves(num) for _ = 1, num do local id = #m.braves + 1 - log.info('Create brave:', id) + log.debug('Create brave:', id) m.braves[id] = { id = id, thread = thread.thread(braveTemplate:format( diff --git a/script/service/service.lua b/script/service/service.lua index a1db02a8..26790c63 100644 --- a/script/service/service.lua +++ b/script/service/service.lua @@ -128,7 +128,7 @@ function m.reportProto() end function m.report() - local t = timer.loop(60.0, function () + local t = timer.loop(600.0, function () local lines = {} lines[#lines+1] = '' lines[#lines+1] = '========= Medical Examination Report =========' @@ -138,7 +138,7 @@ function m.report() lines[#lines+1] = m.reportProto() lines[#lines+1] = '==============================================' - log.debug(table.concat(lines, '\n')) + log.info(table.concat(lines, '\n')) end) t:onTimer() end diff --git a/script/service/telemetry.lua b/script/service/telemetry.lua index b580f0b9..50af39b1 100644 --- a/script/service/telemetry.lua +++ b/script/service/telemetry.lua @@ -19,7 +19,7 @@ if not token then util.saveFile(tokenPath, token) end -log.info('Telemetry Token:', token) +log.debug('Telemetry Token:', token) local function getClientName() nonil.enable() diff --git a/script/workspace/loading.lua b/script/workspace/loading.lua index 3cdeaad6..fa8f780f 100644 --- a/script/workspace/loading.lua +++ b/script/workspace/loading.lua @@ -85,7 +85,7 @@ function mt:loadFile(uri, libraryUri) files.addRef(uri) end self._cache[uri] = true - log.info(('Skip loaded file: %s'):format(uri)) + log.debug(('Skip loaded file: %s'):format(uri)) else local content = pub.awaitTask('loadFile', furi.decode(uri)) self.read = self.read + 1 @@ -93,7 +93,7 @@ function mt:loadFile(uri, libraryUri) if not content then return end - log.info(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) + log.debug(('Preload file at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) files.setText(uri, content, false) if not self._cache[uri] then files.addRef(uri) @@ -101,7 +101,7 @@ function mt:loadFile(uri, libraryUri) self._cache[uri] = true end if libraryUri then - log.info('++++As library of:', libraryUri) + log.debug('++++As library of:', libraryUri) end end elseif files.isDll(uri) then @@ -116,7 +116,7 @@ function mt:loadFile(uri, libraryUri) files.addRef(uri) end self._cache[uri] = true - log.info(('Skip loaded file: %s'):format(uri)) + log.debug(('Skip loaded file: %s'):format(uri)) else local content = pub.awaitTask('loadFile', furi.decode(uri)) self.read = self.read + 1 @@ -124,7 +124,7 @@ function mt:loadFile(uri, libraryUri) if not content then return end - log.info(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) + log.debug(('Preload dll at: %s , size = %.3f KB'):format(uri, #content / 1024.0)) files.saveDll(uri, content) if not self._cache[uri] then files.addRef(uri) @@ -132,7 +132,7 @@ function mt:loadFile(uri, libraryUri) self._cache[uri] = true end if libraryUri then - log.info('++++As library of:', libraryUri) + log.debug('++++As library of:', libraryUri) end end end @@ -142,7 +142,6 @@ end ---@async function mt:loadAll() while self.read < self.max do - log.info(('Loaded %d/%d files'):format(self.read, self.max)) self:update() local loader = table.remove(self._stash) if loader then diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 934c0735..c0385085 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -100,7 +100,7 @@ function m.getNativeMatcher(scp) local pattern = {} for path, ignore in pairs(config.get(scp.uri, 'files.exclude')) do if ignore then - log.info('Ignore by exclude:', path) + log.debug('Ignore by exclude:', path) pattern[#pattern+1] = path end end @@ -109,7 +109,7 @@ function m.getNativeMatcher(scp) if buf then for line in buf:gmatch '[^\r\n]+' do if line:sub(1, 1) ~= '#' then - log.info('Ignore by .gitignore:', line) + log.debug('Ignore by .gitignore:', line) pattern[#pattern+1] = line end end @@ -118,7 +118,7 @@ function m.getNativeMatcher(scp) if buf then for line in buf:gmatch '[^\r\n]+' do if line:sub(1, 1) ~= '#' then - log.info('Ignore by .git/info/exclude:', line) + log.debug('Ignore by .git/info/exclude:', line) pattern[#pattern+1] = line end end @@ -128,7 +128,7 @@ function m.getNativeMatcher(scp) local buf = util.loadFile(furi.decode(scp.uri) .. '/.gitmodules') if buf then for path in buf:gmatch('path = ([^\r\n]+)') do - log.info('Ignore by .gitmodules:', path) + log.debug('Ignore by .gitmodules:', path) pattern[#pattern+1] = path end end @@ -136,12 +136,12 @@ function m.getNativeMatcher(scp) for path in pairs(config.get(scp.uri, 'Lua.workspace.library')) do path = m.getAbsolutePath(scp.uri, path) if path then - log.info('Ignore by library:', path) - pattern[#pattern+1] = path + log.debug('Ignore by library:', path) + debug[#pattern+1] = path end end for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.ignoreDir')) do - log.info('Ignore directory:', path) + log.debug('Ignore directory:', path) pattern[#pattern+1] = path end @@ -160,17 +160,17 @@ function m.getLibraryMatchers(scp) if scp:get 'libraryMatcher' then return scp:get 'libraryMatcher' end - log.info('Build library matchers:', scp) + log.debug('Build library matchers:', scp) local pattern = {} for path, ignore in pairs(config.get(scp.uri, 'files.exclude')) do if ignore then - log.info('Ignore by exclude:', path) + log.debug('Ignore by exclude:', path) pattern[#pattern+1] = path end end for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.ignoreDir')) do - log.info('Ignore directory:', path) + log.debug('Ignore directory:', path) pattern[#pattern+1] = path end @@ -181,7 +181,7 @@ function m.getLibraryMatchers(scp) librarys[m.normalize(path)] = true end end - log.info('meta path:', scp:get 'metaPath') + log.debug('meta path:', scp:get 'metaPath') if scp:get 'metaPath' then librarys[m.normalize(scp:get 'metaPath')] = true end |