From 24e3bfa168250a99d5543b7c6604af9f11a4d2b6 Mon Sep 17 00:00:00 2001 From: Florian Fischer Date: Mon, 30 Dec 2024 08:55:49 +0100 Subject: lazily initialize the default logger In order for the user to configure the logging behavior the values of lspc.logging and lspc.log_file must be evaluated after vis-lspc was required. To lazily evaluate the logging configuration a new LazyInitLogger metatable is introduced, which initializes the actual logger on first use. Fixes: 1bd1416c89f92f637ca5e22c94b3479f8d32f2d7 --- init.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'init.lua') diff --git a/init.lua b/init.lua index 15d03b5..9906f29 100644 --- a/init.lua +++ b/init.lua @@ -27,7 +27,7 @@ local source_path = source_str:match('(.*/)') local lspc = dofile(source_path .. 'lspc.lua') -- initialise the logging system -lspc.logger = dofile(source_path .. 'log.lua').new('lspc', lspc.logging, lspc.log_file) +lspc.logger = dofile(source_path .. 'log.lua').lazyNew('lspc', lspc) local parser = dofile(source_path .. 'parser.lua') -- cgit v1.2.3