code wiki / (root) / nx_log_jsonl.nx

nx_log_jsonl.nx

buildroot/runtime/nx_log_jsonl.nx

13710 B361 linesdepth 0pulls 0 transitivereach 7 importersview sourcekind librarytopic log
docsdependenciesstructsconstsfunctions

about

nx_log_jsonl.nx -- structured JSONL log line emitter. One line per log entry, JSON-encoded. Consumable by any log aggregator: Loki / Splunk / Elasticsearch / Datadog / `jq`. Standard S-class hosting log shape. Per cardinal feedback-no-third-party-trust-native-or-nothing: substrate's own log emitter; no logrus, no log4j, no syslog SDK. Substrate produces JSON; any consumer reads. Per cardinal feedback-defensive-at-boundaries-trusting-internally: log values are escaped for JSON safety (string escape per RFC 8259 ยง7) so log-injection attacks via newlines or quotes in user input are structurally prevented. One log line shape: {"ts_ms":12345,"level":"INFO","module":"nx_audit","msg":"hello"}\n Caller can add k=v fields via nx_log_field_str / _int after opening the entry + before closing. Fields are encoded inline: {"ts_ms":1,"level":"WARN","module":"x","msg":"y","retry":3}\n nx_capability_claims: needs: [sealed_enum, bounded_buffer, json_string_escape] provides: [structured_log_emit, log_injection_prevention] safety: [no_unchecked_deref, no_floating_point, no_syscall, bounded_iteration, json_value_escape_at_boundary] verdict: [sealed_enum_4_state_severity + sealed_enum_4_verdict] license: ORIGINAL kind: racing_crew_specialist layer: L3 (algorithm: structured emit)

dependencies 0 imports · 4 importers

nx_log_jsonl.nx nx_audit_server_routed.nx nx_log_jsonl_test.nx nx_wiki_main.nx nx_wiki_routes.nx

imports: none

imported by: nx_audit_server_routed.nxnx_log_jsonl_test.nxnx_wiki_main.nxnx_wiki_routes.nx

structs

none

consts

37const NXL_DEBUG: i64 = 0
38const NXL_INFO: i64 = 1
39const NXL_WARN: i64 = 2
40const NXL_ERROR: i64 = 3
41const NXL_LEVEL_N: i64 = 4
67const NXL_OK: i64 = 0
68const NXL_OOM_BUFFER: i64 = 1
69const NXL_BAD_LEVEL: i64 = 2
70const NXL_BAD_ARG: i64 = 3
71const NXL_VERDICT_N: i64 = 4

functions

43func nxl_level_is_valid(L: i64) -> i64
49func nxl_level_name(L: i64) -> *u8
57func nxl_level_name_len(L: i64) -> i64
73func nxl_verdict_is_valid(v: i64) -> i64
called by 1: main
79func nxl_verdict_name(v: i64) -> *u8
89func nxl_put(out: *u8, off: *i64, cap: i64, b: i64) -> i64
96func nxl_put_cstr(out: *u8, off: *i64, cap: i64, s: *u8) -> i64
106func nxl_put_bytes(out: *u8, off: *i64, cap: i64, src: *u8, n: i64) -> i64
128func nxl_put_json_str_bytes(out: *u8, off: *i64, cap: i64,
185func nxl_put_dec(out: *u8, off: *i64, cap: i64,
215func nx_log_emit_line(
258func nx_log_emit_line_with_str(
314func nx_log_emit_line_with_int(