@yuneta/gobj-js 7.13.6 → 7.13.8

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.
@@ -383,7 +383,7 @@ var Event_Type = class {
383
383
  function tab() {
384
384
  return " ".repeat(Math.max(1, __inside__ * 2));
385
385
  }
386
- var __trace_machine_format__ = 0;
386
+ var __trace_machine_format__ = 1;
387
387
  function gobj_set_trace_machine_format(format) {
388
388
  __trace_machine_format__ = Number(format) === 1 ? 1 : 0;
389
389
  }
@@ -2296,7 +2296,9 @@ function gobj_change_state(gobj, state_name) {
2296
2296
  gobj.current_state = new_state;
2297
2297
  let tracea = is_machine_tracing(gobj, "EV_STATE_CHANGED");
2298
2298
  let tracea_states = __trace_gobj_states__(gobj) ? true : false;
2299
- if (tracea || tracea_states) trace_machine(sprintf("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", !gobj.running ? "!!" : "", gobj_gclass_name(gobj), gobj_name(gobj), gobj_current_state(gobj), gobj.last_state.state_name));
2299
+ if (tracea || tracea_states) {
2300
+ if (__trace_machine_format__ === 1) {} else trace_machine(sprintf("🔀🔀 mach(%s%s^%s), new st(%s), prev st(%s)", !gobj.running ? "!!" : "", gobj_gclass_name(gobj), gobj_name(gobj), gobj_current_state(gobj), gobj.last_state.state_name));
2301
+ }
2300
2302
  return true;
2301
2303
  }
2302
2304
  /***************************************************************************
@@ -2489,7 +2491,8 @@ function gobj_send_event(dst, event, kw, src) {
2489
2491
  if (dst.gclass.gmt.mt_inject_event) {
2490
2492
  __inside__--;
2491
2493
  if (tracea) {
2492
- trace_machine(sprintf("🔃 mach(%s%s), st: %s, ev: %s, from(%s%s)", !dst.running ? "!!" : "", gobj_short_name(dst), state.state_name, event ? event : "", src && !src.running ? "!!" : "", gobj_short_name(src)));
2494
+ if (__trace_machine_format__ === 1) trace_machine(sprintf("🔜 %s %s%s %s", event ? event : "", !dst.running ? "!!" : "", gobj_short_name(dst), state.state_name));
2495
+ else trace_machine(sprintf("🔃 mach(%s%s), st: %s, ev: %s, from(%s%s)", !dst.running ? "!!" : "", gobj_short_name(dst), state.state_name, event ? event : "", src && !src.running ? "!!" : "", gobj_short_name(src)));
2493
2496
  if (kw) {
2494
2497
  if (tracea > 1) {
2495
2498
  if (json_object_size(kw)) trace_json(kw);
@@ -2870,8 +2873,9 @@ function gobj_publish_event(publisher, event, kw) {
2870
2873
  }
2871
2874
  let tracea = __yuno__ && gobj_read_bool_attr(__yuno__, "trace_subscriptions");
2872
2875
  if (tracea) {
2873
- trace_machine(sprintf("🔝🔝 mach(%s%s^%s), st: %s, ev: %s%s%s", !publisher.running ? "!!" : "", gobj_gclass_name(publisher), gobj_name(publisher), publisher.current_state.state_name, "", event ? event : "", ""));
2874
- trace_json(kw);
2876
+ if (__trace_machine_format__ === 1) trace_machine(sprintf("🔝🔝 %s %s%s %s", event ? event : "", !publisher.running ? "!!" : "", gobj_short_name(publisher), publisher.current_state.state_name));
2877
+ else trace_machine(sprintf("🔝🔝 mach(%s%s^%s), st: %s, ev: %s%s%s", !publisher.running ? "!!" : "", gobj_gclass_name(publisher), gobj_name(publisher), publisher.current_state.state_name, "", event ? event : "", ""));
2878
+ if (json_object_size(kw)) trace_json(kw);
2875
2879
  }
2876
2880
  if (publisher.gclass.gmt.mt_publish_event) {
2877
2881
  let topublish = publisher.gclass.gmt.mt_publish_event(publisher, event, kw);
@@ -2918,8 +2922,9 @@ function gobj_publish_event(publisher, event, kw) {
2918
2922
  if (__config__) {}
2919
2923
  if (__global__) json_object_update(kw2publish, __global__);
2920
2924
  if (tracea) {
2921
- trace_machine(sprintf("🔝🔄 mach(%s%s), st: %s, ev: %s, from(%s%s)", !subscriber.running ? "!!" : "", gobj_short_name(subscriber), gobj_current_state(subscriber), event ? event : "", publisher && !publisher.running ? "!!" : "", gobj_short_name(publisher)));
2922
- trace_json(kw2publish);
2925
+ if (__trace_machine_format__ === 1) trace_machine(sprintf("🔝🔄 %s (%s) %s%s", event ? event : "", event ? event : "", !subscriber.running ? "!!" : "", gobj_short_name(subscriber)));
2926
+ else trace_machine(sprintf("🔝🔄 mach(%s%s), st: %s, ev: %s, from(%s%s)", !subscriber.running ? "!!" : "", gobj_short_name(subscriber), gobj_current_state(subscriber), event ? event : "", publisher && !publisher.running ? "!!" : "", gobj_short_name(publisher)));
2927
+ if (json_object_size(kw2publish)) trace_json(kw2publish);
2923
2928
  }
2924
2929
  let ret_ = gobj_send_event(subscriber, event, kw2publish, publisher);
2925
2930
  if (ret_ < 0 && subs_flag & subs_flag_t.__own_event__) {