···1+local M = {}
2+3+function M.verbose_logger(namespace)
4+ --- Print a message to the user if verbose mode is enabled.
5+ ---@param msg string|table The message to print.
6+ ---@param label string|nil An optional label to include in the message.
7+ local function verbose(msg, label)
8+ label = label or debug.getinfo(3, "n").name
9+ if vim.o.verbose ~= 0 then
10+ local l = label and ":" .. label or ""
11+ if type(msg) == "string" then
12+ print("[" .. namespace .. l .. "] " .. msg)
13+ else
14+ print("[" .. namespace .. l .. "] " .. vim.inspect(msg))
15+ end
16+ end
17+ end
18+ return verbose
19+end
20+21+M.vclib_verbose = M.verbose_logger("vclib")
22+23+return M