@yuneta/gobj-js 7.9.5 → 7.9.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -598,6 +598,44 @@ a GUI route framework output — **including the automata/FSM trace, which arriv
598
598
  as `debug`** — into its own monitor window while keeping the browser console
599
599
  clean (gobj-ui's dev-window "Output" selector does exactly this).
600
600
 
601
+ ### Tracing: the `machine` trace, and the levels around it
602
+
603
+ The FSM is where things happen, so the trace of the FSM **is** the execution
604
+ log. The level model is the C kernel's — same names, same bits — so a level
605
+ means one thing on both sides and a habit learned on a node transfers here.
606
+
607
+ ```javascript
608
+ gobj_set_global_trace("machine", true) // everything
609
+ gobj_set_gclass_trace("C_MY_VIEW", "machine", true)
610
+ gobj_set_gobj_trace(gobj, "ev_kw", true) // + the kw of each event
611
+ gobj_set_gobj_no_trace(noisy, "machine", true) // veto, by the SOURCE gobj
612
+
613
+ gobj_global_trace_level() // the mask in force
614
+ gobj_trace_level(gobj) // global | gclass | gobj, combined
615
+ gobj_repr_global_trace_levels() // [{name, bit, description, set}]
616
+ gobj_set_deep_trace(1) // everything, everywhere
617
+ gobj_set_trace_machine_format(1) // 1 = one compact line per transition
618
+ ```
619
+
620
+ Levels: `machine`, `create_delete`, `create_delete2`, `subscriptions`,
621
+ `start_stop`, `ev_kw`, `authzs`, `states`, `gbuffers`, `timer`, `fs`,
622
+ `liburing`, `timer_periodic`, `liburing_timer`, `commands`. The ones that only
623
+ exist on a node keep their bit rather than being dropped — removing them would
624
+ shift every bit above and break that alignment.
625
+
626
+ A gobj's effective level is the **union** of global, gclass and gobj.
627
+ `timer` / `timer_periodic` light up for their own event only. And the veto is
628
+ asked of the **source**, so one noisy sender can be silenced without turning
629
+ the destination off.
630
+
631
+ The trace arrives as `debug`, so **`set_log_callback()` is how you read it** —
632
+ that is how a dev panel shows the machine inside the app, and how
633
+ `doc.yuneta.io/navigation` feeds the panel under each of its demos.
634
+
635
+ > The yuno attrs `tracing` / `trace_timer` / `trace_creation` /
636
+ > `trace_start_stop` predate this and still work (gobj-ui's dev panel writes
637
+ > them); they fold in as one more source of bits.
638
+
601
639
  ### i18n: `refresh_language` and the `data-i18n-*` family
602
640
 
603
641
  The runtime does not translate anything itself — the **app** owns the
@@ -384,7 +384,7 @@ var Event_Type = class {
384
384
  }
385
385
  };
386
386
  function tab() {
387
- return " ".repeat(Math.max(0, __inside__ * 2 - 1));
387
+ return " ".repeat(Math.max(1, __inside__ * 2));
388
388
  }
389
389
  var __trace_machine_format__ = 0;
390
390
  function gobj_set_trace_machine_format(format) {
@@ -644,6 +644,18 @@ function gobj_set_gobj_trace(gobj, level, set) {
644
644
  else gobj.trace_level &= ~bitmask;
645
645
  return 0;
646
646
  }
647
+ function gobj_set_gclass_no_trace(gclass, level, set) {
648
+ const gclass_ = is_string(gclass) ? gclass_find_by_name(gclass) : gclass;
649
+ if (!gclass_) {
650
+ log_error(`gobj_set_gclass_no_trace: gclass NOT FOUND: ${gclass}`);
651
+ return -1;
652
+ }
653
+ const bitmask = trace_bitmask(level, "gobj_set_gclass_no_trace");
654
+ if (!bitmask) return -1;
655
+ if (set) gclass_.no_trace_level |= bitmask;
656
+ else gclass_.no_trace_level &= ~bitmask;
657
+ return 0;
658
+ }
647
659
  function gobj_set_gobj_no_trace(gobj, level, set) {
648
660
  if (!gobj) {
649
661
  log_error(`gobj_set_gobj_no_trace: gobj NULL`);
@@ -6596,6 +6608,7 @@ exports.gobj_send_event = gobj_send_event;
6596
6608
  exports.gobj_services = gobj_services;
6597
6609
  exports.gobj_set_bottom_gobj = gobj_set_bottom_gobj;
6598
6610
  exports.gobj_set_deep_trace = gobj_set_deep_trace;
6611
+ exports.gobj_set_gclass_no_trace = gobj_set_gclass_no_trace;
6599
6612
  exports.gobj_set_gclass_trace = gobj_set_gclass_trace;
6600
6613
  exports.gobj_set_global_no_trace = gobj_set_global_no_trace;
6601
6614
  exports.gobj_set_global_trace = gobj_set_global_trace;