aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2021-08-16 13:56:38 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2021-08-16 13:58:05 +0200
commitbcab92186e8bd66e6841f33275d261af00e43a25 (patch)
tree51ba4bd5ef6a9256cba756d8d6667f8984721c8c
parent85e8aced46fecc5acbdf96bac5dc3af6217ba16e (diff)
downloadvis-lspc-bcab92186e8bd66e6841f33275d261af00e43a25.tar.gz
vis-lspc-bcab92186e8bd66e6841f33275d261af00e43a25.zip
write errors and warnings to the log
-rw-r--r--init.lua15
1 files changed, 10 insertions, 5 deletions
diff --git a/init.lua b/init.lua
index 5ef81a0..51993ed 100644
--- a/init.lua
+++ b/init.lua
@@ -1,12 +1,20 @@
-- Copyright (c) 2021 Florian Fischer. All rights reserved.
-- Use of this source code is governed by a MIT license found in the LICENSE file.
-- We require vis compiled with the communicate patch
+
+-- forward declaration of our client table
+local lspc
+
local function lspc_warn(msg)
- vis:info('LSPC Warning: ' .. msg)
+ local warning = 'LSPC Warning: ' .. msg
+ lspc.log(warning)
+ vis:info(warning)
end
local function lspc_err(msg)
- vis:info('LSPC Error: ' .. msg)
+ local err = 'LSPC Error: ' .. msg
+ lspc.log(err)
+ vis:info(err)
end
if not vis.communicate then
@@ -70,9 +78,6 @@ do
end
assert(vis_pid)
--- forward declaration of our client table
-local lspc
-
-- logging system
-- if lspc.logging is set to true the first call to lspc.log
-- will open the log file and replace lspc.log with the actual log function