summaryrefslogtreecommitdiff
path: root/otfl-luat-ovr.lua
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-15 00:14:23 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-15 00:14:23 +0200
commit25444ac8cd48cd5ad7ed32bfcc9a0a1314e2223a (patch)
treee56c6909cdfacac4f383f203fdd8c228c41fae76 /otfl-luat-ovr.lua
parent7b6553218a35e5f74ad2013a1a16f54b8aa4f2ca (diff)
downloadluaotfload-25444ac8cd48cd5ad7ed32bfcc9a0a1314e2223a.tar.gz
rewrite filename logger
Diffstat (limited to 'otfl-luat-ovr.lua')
-rw-r--r--otfl-luat-ovr.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/otfl-luat-ovr.lua b/otfl-luat-ovr.lua
index 984dbf5..63ad6a7 100644
--- a/otfl-luat-ovr.lua
+++ b/otfl-luat-ovr.lua
@@ -11,9 +11,32 @@ local module_name = "luaotfload"
local texiowrite_nl = texio.write_nl
local stringformat = string.format
+local tableconcat = table.concat
local ioflush = io.flush
local dummyfunction = function() end
+--[[doc--
+We recreate the verbosity levels previously implemented in font-nms:
+
+ ==========================================================
+ lvl arg trace_loading trace_search suppress_output
+ ----------------------------------------------------------
+ (0) -> -q ⊥ ⊥ ⊤
+ (1) -> ∅ ⊥ ⊥ ⊥
+ (2) -> -v ⊤ ⊥ ⊥
+ (>2) -> -vv ⊤ ⊤ ⊥
+ ==========================================================
+
+--doc]]--
+local loglevel = 1 --- default
+
+local set_loglevel = function (n)
+ if type(n) == "number" then
+ loglevel = n
+ end
+end
+logs.set_loglevel = set_loglevel
+
function logs.report(category,fmt,...)
if fmt then
texiowrite_nl('log', stringformat("%s | %s: %s",module_name,category,stringformat(fmt,...)))
@@ -35,3 +58,14 @@ function logs.info(category,fmt,...)
ioflush()
end
+logs.names_loading = function (category, fmt, ...)
+ if loglevel > 1 then
+ local res = { module_name, " |" }
+ if category then res[#res+1] = " " .. category end
+ if fmt then res[#res+1] = ": " .. stringformat(fmt, ...) end
+ texiowrite_nl(tableconcat(res))
+ ioflush()
+ end
+end
+
+-- vim:tw=71:sw=4:ts=4:expandtab