Expand description
log recording and reporting interface
Structs§
- Captured
Diagnostics - Diagnostics captured from a worker thread by
capture, for the main thread to fold back in viareplay_captured. Carries both the already-formatted log text AND theREPORTcount deltas —LOG_BUFFERandREPORTare BOTH per-thread, so forwarding only the text would still leavestatus_codeblind to a worker’s failures. - Deferred
Diagnostics - Diagnostics a
DiagnosticsHoldset aside (DiagnosticsHold::defer) for work done ahead of its use: written and counted only when replayed. An\autorefname is built at its target but typeset — and its errors raised, in TeX — only where an\autorefprints it (ruling 7e;replay_shown_deferred; witness biblatex-gost-examples, hyperref’s Russian\cyr…names under TU). - Diagnostics
Hold - A speculative scope’s diagnostics, held until the caller decides whether
the scope’s RESULT is kept. For work the engine runs on its own initiative
in a state the document never produces — the
\maketitledeposit replays a class’s dropped title body with the title fields emptied — so that its diagnostics are the document’s exactly when its output is:
Functions§
- append_
logged_ text - Append to the bound log text already logged once (a worker’s captured log, a session’s log), on a fresh line; not re-mirrored, as the mirror took it when it was first written.
- bind_
log - Start capturing log output into the buffer (Perl: bind_log).
- capture
- Run
fon the CURRENT (worker) thread with diagnostic capture. Binds a fresh thread-local log buffer for the duration so anyError!/Warn!/Info!femits (directly or deep inside a conversion helper) is recorded instead of lost, and snapshots the worker’sREPORTcounters afterward. The returnedCapturedDiagnosticsis replayed on the main thread byreplay_capturedafter the worker is joined, so the messages reach the boundcortex.logand the failures register instatus_code. - debug_
all - Whether un-featured
Debugrecords are logged (--verbose; seeDEBUG_ALL). - defer_
to_ label - The target of
labelanswers for deferred diagnosticsid, raised by its (or its ancestor’s) tag ofrole. - deferred_
kept - Whether any deferred diagnostics are kept: a held tag may wait in the document (sect11.rs
settle_held_tags). - empty_
held_ tags_ pending - Whether an empty held tag is waiting for its target to settle it (
note_empty_held_tag). - flush_
log - Flush and return the captured log output, stopping capture (Perl: flush_log).
- init
- initialize the logger at a given STDERR verbosity
level - keep_
deferred - Keep deferred diagnostics; their id.
- note_
empty_ held_ tag - A held tag (
\lx@tag@intags@held, latexml_engine tags_refnums.rs) that typeset nothing but holds diagnostics (_deferred) is kept, empty, until its target closes, which ties them to its labels (latex_constructs sect11.rstie_held_tags) and then removes it (take_empty_held_tag); one no target closed over (a caption’s tags folded into a minipage panel) is settled once the document is built (sect11.rssettle_held_tags, tied to its owner’s labels only: an unlabelled owner drops it with its diagnostics). A form that errs gives no content, and its errors are raised where a reference prints its role (cleveref_sty.rs\lx@cref@docformat; 2008.12750, 2604.24399). - note_
held_ stub - Record that
tokenwas just stubbed as undefined, when aDiagnosticsHoldis active. - note_
label_ use - A reference to
labelprints its target’s tags asshownames them. - note_
to_ log - Append a progress note to the captured log (
.latexml.log) only — the LOG half of PerlNote/NoteLog(Common/Error.pm:print $LOG _freshline($LOG), strip_ansi($message), "\n" if $LOG). ANSI is stripped and the note lands on its own fresh line with a single trailing newline, so CorTeX’s line-anchored parser and the.latexml.logstay clean (mirrors the diagnostic-record freshline path below). No-op when no buffer is bound or output is suppressed — unlike alog::info!record it is NOT gated on the stderr verbosity, because the log is the verbose record (Perl writes it regardless of$VERBOSITY). - replay_
captured - Fold worker-thread diagnostics (from
capture) into the main thread: append the captured log text to the boundLOG_BUFFERand merge the count deltas into the mainREPORT. Call on the MAIN thread, in a deterministic order (e.g. worker/job order), after the workers join. The worker already echoed each line to the shared stderr fd in real time, so this does NOT re-print to stderr — it only repairs the captured log + status tally. - replay_
shown_ deferred - Replay the deferred diagnostics of every tag a reference prints — a held tag of role R answering for a label,
referenced with a
shownaming R (a word of it: CrossRef’s show words,autoref,typerefnum…; a looser split than CrossRef’s, so it can only replay more) — once each; the rest are dropped unraised, as TeX never typesets them. Run once the document is built (forward references included); empties the job’s registries. - reset_
deferred_ diagnostics - Forget the job’s deferred diagnostics (each conversion’s
initialize_report), the empty held tags it was waiting on too: a persistent worker’s next paper starts at none. - reset_
log_ mirror - Empty the log mirror (a new conversion begins).
- set_
log_ mirror - Mirror the captured log into
file(opened for appending), emptying it whenever it would grow pastcap_bytes;Nonestops mirroring. - set_
stderr_ at_ line_ start - Records where a write that bypassed the logger (
watchdog::write_stderr_unlocked) left stderr’s cursor. - settled_
empty_ held_ tags - The document is built: every empty held tag is settled (
note_empty_held_tag). - stderr_
admits - Does the current STDERR verbosity admit a record of
level?Error/Fatalare handled unconditionally by the caller (the project’s deliberate always-emit-errors divergence); this governs the verbosity-gated levels. - stderr_
at_ line_ start - Whether stderr sits at the start of a line (
STDERR_AT_LINE_START): read without the stderr lock bycrate::watchdog::write_stderr_unlocked, which must not wait on a stuck thread. - stderr_
fresh_ line - Perl
print STDERR _freshline(\*STDERR), $text: a direct STDERR write at any verbosity, on a fresh line. One write under the (reentrant) stderr lock, so a capture buffer shared by a test’s threads never splits a line. - stderr_
level - The current STDERR verbosity (
STDERR_LEVEL):--quietError, the defaultInfo,--verboseDebug. - stderr_
shows_ info - Whether STDERR currently shows
Info-level progress notes — Perl$VERBOSITY >= 0. TheNote!/NoteSTDERR!macros gate their STDERR echo on this, decoupled from the log-file floor so--quietsilences the console note while the log keeps it (issue #763). - take_
empty_ held_ tag - One empty held tag (
note_empty_held_tag) was removed. - try_
with_ log_ text - The log captured so far, unflushed, for a panic hook:
Nonewhen no log is bound or the panic holds the buffer.