diff options
author | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-05 23:34:13 +0200 |
---|---|---|
committer | Philipp Gesang <phg42.2a@gmail.com> | 2013-07-05 23:34:13 +0200 |
commit | f09597aaf6cb7b70eacc2b7399ee743736c0893a (patch) | |
tree | 93cf0a0d074380cf48e21646c464d80208cf8737 | |
parent | 68c63252eb0da3d1d67bf7534032d020edfc70ef (diff) | |
download | luaotfload-f09597aaf6cb7b70eacc2b7399ee743736c0893a.tar.gz |
fix duplication in log output
-rw-r--r-- | luaotfload-override.lua | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/luaotfload-override.lua b/luaotfload-override.lua index 39cc172..adc0426 100644 --- a/luaotfload-override.lua +++ b/luaotfload-override.lua @@ -32,6 +32,12 @@ local texio_write = texio.write local texiowrite = texio.write local type = type +local texjob = false +if tex and (tex.jobname or tex.formatname) then + --- TeX + texjob = true +end + --[[doc-- We recreate the verbosity levels previously implemented in font-nms: @@ -136,10 +142,9 @@ end logs.set_logout = set_logout local log = function (category, fmt, ...) - local res = { module_name, " |" } - if category then res[#res+1] = " " .. category end - if fmt then res[#res+1] = ": " .. stringformat(fmt, ...) end - texiowrite_nl(logout, tableconcat(res)) + local res = { module_name, "|", category, ":" } + if fmt then res[#res+1] = stringformat(fmt, ...) end + texiowrite_nl(logout, tableconcat(res, " ")) end --- with faux db update with maximum verbosity: @@ -156,11 +161,11 @@ end io.stdout:setvbuf "no" io.stderr:setvbuf "no" -if tex and (tex.jobname or tex.formatname) then - --- TeX - writeln = texiowrite_nl +if texjob == true then + writeln = function (str) + texiowrite_nl ("term", str) + end else - --- Lua interpreter writeln = function (str) iowrite(str) iowrite "\n" @@ -171,7 +176,8 @@ stdout = function (category, ...) local res = { module_name, "|", category, ":" } local nargs = select("#", ...) if nargs == 0 then - writeln (tableconcat ({...})) + --writeln tableconcat(res, " ") + --return elseif nargs == 1 then res[#res+1] = select(1, ...) -- around 30% faster than unpack() else |