Diff

init.lua @ 461:fa5c40e5e079

Use util.format for logging
author Matthew Wild <mwild1@gmail.com>
date Thu, 16 Mar 2023 11:46:16 +0000
parent 444:12c1be0044c6
child 463:98fe3ed54639
line wrap: on
line diff
--- a/init.lua	Thu Mar 16 11:43:16 2023 +0000
+++ b/init.lua	Thu Mar 16 11:46:16 2023 +0000
@@ -11,6 +11,8 @@
 local events = require "util.events";
 local logger = require "util.logger";
 
+local format = require "util.format".format;
+
 local verse = {};
 verse.server = server;
 
@@ -50,11 +52,6 @@
 verse.new_logger = logger.init;
 verse.log = verse.logger("verse");
 
-local function format(format, ...)
-	local n, arg, maxn = 0, { ... }, select('#', ...);
-	return (format:gsub("%%(.)", function (c) if n <= maxn then n = n + 1; return tostring(arg[n]); end end));
-end
-
 function verse.set_log_handler(log_handler, levels)
 	levels = levels or { "debug", "info", "warn", "error" };
 	logger.reset();