Skip to main content

Module logger

Module logger 

Source
Expand description

log recording and reporting interface

Structs§

CapturedDiagnostics
Diagnostics captured from a worker thread by capture, for the main thread to fold back in via replay_captured. Carries both the already-formatted log text AND the REPORT count deltas — LOG_BUFFER and REPORT are BOTH per-thread, so forwarding only the text would still leave status_code blind to a worker’s failures.
DeferredDiagnostics
Diagnostics a DiagnosticsHold set aside (DiagnosticsHold::defer) for work done ahead of its use: written and counted only when replayed. An \autoref name is built at its target but typeset — and its errors raised, in TeX — only where an \autoref prints it (ruling 7e; replay_shown_deferred; witness biblatex-gost-examples, hyperref’s Russian \cyr… names under TU).
DiagnosticsHold
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 \maketitle deposit 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 f on the CURRENT (worker) thread with diagnostic capture. Binds a fresh thread-local log buffer for the duration so any Error!/Warn!/Info! f emits (directly or deep inside a conversion helper) is recorded instead of lost, and snapshots the worker’s REPORT counters afterward. The returned CapturedDiagnostics is replayed on the main thread by replay_captured after the worker is joined, so the messages reach the bound cortex.log and the failures register in status_code.
debug_all
Whether un-featured Debug records are logged (--verbose; see DEBUG_ALL).
defer_to_label
The target of label answers for deferred diagnostics id, raised by its (or its ancestor’s) tag of role.
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.rs tie_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.rs settle_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 token was just stubbed as undefined, when a DiagnosticsHold is active.
note_label_use
A reference to label prints its target’s tags as show names them.
note_to_log
Append a progress note to the captured log (.latexml.log) only — the LOG half of Perl Note/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.log stay clean (mirrors the diagnostic-record freshline path below). No-op when no buffer is bound or output is suppressed — unlike a log::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 bound LOG_BUFFER and merge the count deltas into the main REPORT. 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 show naming 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 past cap_bytes; None stops 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/Fatal are 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 by crate::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): --quiet Error, the default Info, --verbose Debug.
stderr_shows_info
Whether STDERR currently shows Info-level progress notes — Perl $VERBOSITY >= 0. The Note!/NoteSTDERR! macros gate their STDERR echo on this, decoupled from the log-file floor so --quiet silences 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: None when no log is bound or the panic holds the buffer.