diff options
Diffstat (limited to 'tex/context/base/trac-log.lua')
-rw-r--r-- | tex/context/base/trac-log.lua | 80 |
1 files changed, 71 insertions, 9 deletions
diff --git a/tex/context/base/trac-log.lua b/tex/context/base/trac-log.lua index 2b84ba487..6a6bd39cb 100644 --- a/tex/context/base/trac-log.lua +++ b/tex/context/base/trac-log.lua @@ -6,6 +6,60 @@ if not modules then modules = { } end modules ['trac-log'] = { license = "see context related readme files" } +if tex and (tex.jobname or tex.formatname) then + + -- quick hack, awaiting speedup in engine (8 -> 6.4 sec for --make with console2) + + local texio_write_nl = texio.write_nl + local texio_write = texio.write + local io_write = io.write + + local write_nl = function(target,...) + if not io_write then + io_write = io.write + end + if target == "term and log" then + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(...) + elseif target == "log" then + texio_write_nl("log",...) + elseif target == "term" then + texio_write_nl("term","") + io_write(...) + else + texio_write_nl("log",...) + texio_write_nl("term","") + io_write(target,...) + end + end + + local write = function(target,...) + if not io_write then + io_write = io.write + end + if target == "term and log" then + texio_write("log",...) + io_write(...) + elseif target == "log" then + texio_write("log",...) + elseif target == "term" then + io_write(...) + else + texio_write("log",...) + io_write(target,...) + end + end + + texio.write = write + texio.write_nl = write_nl + +else + + -- texlua + +end + -- todo: less categories, more subcategories (e.g. nodes) -- todo: split into basics and ctx specific @@ -217,8 +271,6 @@ if tex and (tex.jobname or tex.formatname) then else --- local format = string.formatter - logs.flush = ignore writer = write_nl @@ -449,6 +501,16 @@ function logs.show() report("logging","categories: %s, max category: %s, max subcategory: %s, max combined: %s",n,c,s,max) end +local delayed_reporters = { } setmetatableindex(delayed_reporters,function(t,k) + local v = logs.reporter(k) + t[k] = v + return v +end) + +function utilities.setters.report(setter,...) + delayed_reporters[setter](...) +end + directives.register("logs.blocked", function(v) setblocked(v,true) end) @@ -513,15 +575,12 @@ function logs.stop_page_number() -- the first page can includes the initializati logs.flush() end -logs.report_job_stat = statistics and statistics.showjobstat +-- we don't have show_open and show_close callbacks yet local report_files = logs.reporter("files") - -local nesting = 0 -local verbose = false -local hasscheme = url.hasscheme - --- we don't have show_open and show_close callbacks yet +local nesting = 0 +local verbose = false +local hasscheme = url.hasscheme function logs.show_open(name) -- if hasscheme(name) ~= "virtual" then @@ -699,3 +758,6 @@ end io.stdout:setvbuf('no') io.stderr:setvbuf('no') + +-- windows: > nul 2>&1 +-- unix : > null 2>&1 |