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#[thread_local], so forwarding only the text would still leavestatus_codeblind to a worker’s failures.
Functions§
- 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. - flush_
log - Flush and return the captured log output, stopping capture (Perl: flush_log).
- init
- initialize the logger at a given verbosity
level - mark_
stderr_ at_ line_ start - Tell the logger that stderr is back at line start. For the
Note!/NoteLog!macros, which write to stderr directly viaprintln_stderr!rather than throughlog::Log— without this the next diagnostic record could emit a spurious leading newline. - 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.