summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Gesang <phg42.2a@gmail.com>2013-04-10 22:57:21 +0200
committerPhilipp Gesang <phg42.2a@gmail.com>2013-04-10 22:57:21 +0200
commit6fbac590374db31f6dd03cafc363657efc6f4a44 (patch)
tree00fe2a46f24147a13f67bf22faf548628989a836
parent284c5ae14e8f7f74155b97dc8bae97f8fc84f8b5 (diff)
downloadluaotfload-6fbac590374db31f6dd03cafc363657efc6f4a44.tar.gz
make loglevel “-q” effective
-rwxr-xr-xmkluatexfontdb.lua3
-rw-r--r--otfl-font-nms.lua37
2 files changed, 22 insertions, 18 deletions
diff --git a/mkluatexfontdb.lua b/mkluatexfontdb.lua
index 11ef8ba..0a2ddd3 100755
--- a/mkluatexfontdb.lua
+++ b/mkluatexfontdb.lua
@@ -79,7 +79,7 @@ local force_reload = nil
local function process_cmdline()
local options, _, _ = alt_getopt.get_ordered_opts (arg, short_options, long_options)
local log_level = 1
- for i,v in next, options do
+ for _,v in next, options do
if v == "q" then
log_level = 0
elseif v == "v" then
@@ -111,3 +111,4 @@ end
process_cmdline()
generate(force_reload)
+-- vim:tw=71:sw=4:ts=4:expandtab
diff --git a/otfl-font-nms.lua b/otfl-font-nms.lua
index 3934919..a0d81ae 100644
--- a/otfl-font-nms.lua
+++ b/otfl-font-nms.lua
@@ -39,9 +39,10 @@ local gsub, match, rpadd = string.gsub, string.match, string.rpadd
local gmatch, sub, find = string.gmatch, string.sub, string.find
local utfgsub = unicode.utf8.gsub
-local trace_short = false --tracing adapted to rebuilding of the database inside a document
-local trace_search = false --trackers.register("names.search", function(v) trace_search = v end)
-local trace_loading = false --trackers.register("names.loading", function(v) trace_loading = v end)
+local suppress_output = false
+local trace_short = false --tracing adapted to rebuilding of the database inside a document
+local trace_search = false --trackers.register("names.search", function(v) trace_search = v end)
+local trace_loading = false --trackers.register("names.loading", function(v) trace_loading = v end)
local function sanitize(str)
if str then
@@ -244,7 +245,9 @@ end
names.resolvespec = names.resolve
function names.set_log_level(level)
- if level == 2 then
+ if level == 0 then
+ suppress_output = true
+ elseif level == 2 then
trace_loading = true
elseif level >= 3 then
trace_loading = true
@@ -252,30 +255,29 @@ function names.set_log_level(level)
end
end
-local lastislog = 0
-
-local function log(category, fmt, ...)
- lastislog = 1
- if fmt then
- texio.write_nl(format("luaotfload | %s: %s", category, format(fmt, ...)))
- elseif category then
- texio.write_nl(format("luaotfload | %s", category))
- else
- texio.write_nl(format("luaotfload |"))
+local function log (category, fmt, ...)
+ if not suppress_output then
+ if fmt then
+ texio.write_nl(format("luaotfload | %s: %s", category, format(fmt, ...)))
+ elseif category then
+ texio.write_nl(format("luaotfload | %s", category))
+ else
+ texio.write_nl(format("luaotfload |"))
+ end
+ io.flush()
end
- io.flush()
end
logs = logs or { }
logs.report = logs.report or log
-logs.info = logs.info or log
+logs.info = logs.info or log
local function font_fullinfo(filename, subfont, texmf)
local t = { }
local f = fontloader.open(filename, subfont)
if not f then
if trace_loading then
- logs.report("error", "failed to open %s", filename)
+ logs.report("error", "failed to open %s", filename)
end
return
end
@@ -769,3 +771,4 @@ names.save = save_names
function fonts.names.getfilename(askedname,suffix) -- only supported in mkiv
return ""
end
+-- vim:tw=71:sw=4:ts=4:expandtab