code wiki / (root) / nx_log_gate.nx

nx_log_gate.nx

buildroot/runtime/nx_log_gate.nx

5417 B116 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind gate/prooftopic log
docsdependenciesstructsconstsfunctions

about

nx_log_gate.nx -- the gate for the structured logger 32 modules import. WHY: nx_gensota gen-3 worklist. The module's header makes a STRONG, testable promise -- "deterministic by default: monotonic sequence counter, not wall-clock. Tests can snapshot logs BYTE-FOR-BYTE" -- and a byte-for-byte snapshot claim is only true if the format is fixed-width and the counter has no holes. ★THE TOOTH THAT MATTERS (T4): A FILTERED EVENT MUST NOT ADVANCE THE SEQUENCE. If a dropped event consumed a sequence number, every snapshot would depend on the CURRENT LOG LEVEL -- two runs at different verbosity could never be diffed, which is the whole point of the design. Nothing else in the system would notice; the lines still look perfectly well-formed. The context takes an out_fd directly, so this gate writes to a real file and READS THE BYTES BACK -- a writer is only tested by a read-back. ⚠DELIBERATELY NOT TESTED: nx_log_fatal, which exits the process by contract (NX_LOG_EXIT=200). A gate that called it would kill its own harness; its exit path is proven by inspection here and would need a fork to test honestly -- declared, not silently skipped. license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_log.nx nx_log_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_log.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main gv_ctr sys_mmap gv_head gv_puts sys_write sys_mmap ↻ nlg_eqn nx_log_level_name gv_check gv_puts ↻ sys_openat_wr nx_log_new nx_log_emit ipow10 nx_log_puts nx_log_level_name sys_close nlg_slurp sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ gv_verdict gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap gv_journal sys_openat_append sys_mmap ↻ gv_catn sys_mmap ↻ sys_munmap ↻ sys_now_realtime_sec sys_mmap ↻

structs

none

consts

20const NLG_MODE: i64 = 0x1a4
21const NLG_CAP: i64 = 4096

functions

23func nlg_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
24func nlg_eqn(a: *u8, b: *u8, n: i64) -> i64
called by 1: main
30func nlg_slurp(path: *u8, buf: *u8) -> i64
called by 1: main calls 2: sys_mmapsys_read_file
43func main() -> i64