summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/trac-log.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/trac-log.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/trac-log.lua70
1 files changed, 53 insertions, 17 deletions
diff --git a/Master/texmf-dist/tex/context/base/trac-log.lua b/Master/texmf-dist/tex/context/base/trac-log.lua
index d05bc9fec9c..0d4a1b0a9f1 100644
--- a/Master/texmf-dist/tex/context/base/trac-log.lua
+++ b/Master/texmf-dist/tex/context/base/trac-log.lua
@@ -1,6 +1,6 @@
-if not modules then modules = { } end modules ['luat-log'] = {
+if not modules then modules = { } end modules ['trac-log'] = {
version = 1.001,
- comment = "companion to luat-lib.tex",
+ comment = "companion to trac-log.mkiv",
author = "Hans Hagen, PRAGMA-ADE, Hasselt NL",
copyright = "PRAGMA ADE / ConTeXt Development Team",
license = "see context related readme files"
@@ -8,7 +8,11 @@ if not modules then modules = { } end modules ['luat-log'] = {
-- this is old code that needs an overhaul
-local write_nl, write, format = texio.write_nl or print, texio.write or io.write, string.format
+--~ io.stdout:setvbuf("no")
+--~ io.stderr:setvbuf("no")
+
+local write_nl, write = texio.write_nl or print, texio.write or io.write
+local format, gmatch = string.format, string.gmatch
local texcount = tex and tex.count
if texlua then
@@ -89,25 +93,48 @@ function logs.tex.line(fmt,...) -- new
end
end
+--~ function logs.tex.start_page_number()
+--~ local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno
+--~ if real > 0 then
+--~ if user > 0 then
+--~ if sub > 0 then
+--~ write(format("[%s.%s.%s",real,user,sub))
+--~ else
+--~ write(format("[%s.%s",real,user))
+--~ end
+--~ else
+--~ write(format("[%s",real))
+--~ end
+--~ else
+--~ write("[-")
+--~ end
+--~ end
+
+--~ function logs.tex.stop_page_number()
+--~ write("]")
+--~ end
+
+local real, user, sub
+
function logs.tex.start_page_number()
- local real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno
+ real, user, sub = texcount.realpageno, texcount.userpageno, texcount.subpageno
+end
+
+function logs.tex.stop_page_number()
if real > 0 then
if user > 0 then
if sub > 0 then
- write(format("[%s.%s.%s",real,user,sub))
+ logs.report("pages", "flushing realpage %s, userpage %s, subpage %s",real,user,sub)
else
- write(format("[%s.%s",real,user))
+ logs.report("pages", "flushing realpage %s, userpage %s",real,user)
end
else
- write(format("[%s",real))
+ logs.report("pages", "flushing realpage %s",real)
end
else
- write("[-")
+ logs.report("pages", "flushing page")
end
-end
-
-function logs.tex.stop_page_number()
- write("]")
+ io.flush()
end
logs.tex.report_job_stat = statistics.show_job_stat
@@ -207,7 +234,7 @@ end
function logs.setprogram(_name_,_banner_,_verbose_)
name, banner = _name_, _banner_
if _verbose_ then
- trackers.enable("resolvers.verbose")
+ trackers.enable("resolvers.locating")
end
logs.set_method("tex")
logs.report = report -- also used in libraries
@@ -220,9 +247,9 @@ end
function logs.setverbose(what)
if what then
- trackers.enable("resolvers.verbose")
+ trackers.enable("resolvers.locating")
else
- trackers.disable("resolvers.verbose")
+ trackers.disable("resolvers.locating")
end
logs.verbose = what or false
end
@@ -239,7 +266,7 @@ logs.report = logs.tex.report
logs.simple = logs.tex.report
function logs.reportlines(str) -- todo: <lines></lines>
- for line in str:gmatch("(.-)[\n\r]") do
+ for line in gmatch(str,"(.-)[\n\r]") do
logs.report(line)
end
end
@@ -250,8 +277,12 @@ end
logs.simpleline = logs.reportline
-function logs.help(message,option)
+function logs.reportbanner() -- for scripts too
logs.report(banner)
+end
+
+function logs.help(message,option)
+ logs.reportbanner()
logs.reportline()
logs.reportlines(message)
local moreinfo = logs.moreinfo or ""
@@ -282,3 +313,8 @@ end
--~ for i=1,10 do
--~ logs.system(syslogname,"context","test","fonts","font %s recached due to newer version (%s)","blabla","123")
--~ end
+
+function logs.fatal(where,...)
+ logs.report(where,"fatal error: %s, aborting now",format(...))
+ os.exit()
+end