From bcab92186e8bd66e6841f33275d261af00e43a25 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 16 Aug 2021 13:56:38 +0200 Subject: write errors and warnings to the log --- init.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'init.lua') 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 -- cgit v1.2.3