summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-15 09:16:23 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-15 09:16:23 +0800
commiteae093e634ce411a016f493805fdceda6e525fdd (patch)
tree3d3e9a9703741c0a9f24ce6acd2c0876a96b9c98 /server
parent4f0df1279ebddc9318bf63b778848c5d06965e93 (diff)
downloadlua-language-server-eae093e634ce411a016f493805fdceda6e525fdd.zip
把日志文件分开
Diffstat (limited to 'server')
-rw-r--r--server/src/log.lua2
-rw-r--r--server/src/workspace.lua3
2 files changed, 5 insertions, 0 deletions
diff --git a/server/src/log.lua b/server/src/log.lua
index 3826e4f4..eb34505a 100644
--- a/server/src/log.lua
+++ b/server/src/log.lua
@@ -81,6 +81,8 @@ end
function log.init(root, path)
log.path = path:string()
log.prefix_len = #root:string() + 3
+ log.file = nil
+ log.size = 0
if not fs.exists(path:parent_path()) then
fs.create_directories(path:parent_path())
end
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index aefabb04..5582ca8d 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -74,6 +74,9 @@ function mt:init(rootUri)
return
end
log.info('Workspace inited, root: ', self.root)
+ local logPath = ROOT / 'log' / (rootUri:gsub('[/:]+', '_') .. '.log')
+ log.info('Log path: ', logPath)
+ log.init(ROOT, logPath)
async.call([[
require 'utility'
local fs = require 'bee.filesystem'