@yuneta/gobj-js 7.9.4 → 7.9.6
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/dist/gobj-js.cjs.js +293 -18
- package/dist/gobj-js.cjs.js.map +1 -1
- package/dist/gobj-js.cjs.min.js +1267 -1093
- package/dist/gobj-js.cjs.min.js.map +1 -1
- package/dist/gobj-js.es.js +283 -19
- package/dist/gobj-js.es.js.map +1 -1
- package/dist/gobj-js.es.min.js +1245 -1063
- package/dist/gobj-js.es.min.js.map +1 -1
- package/dist/gobj-js.iife.js +293 -18
- package/dist/gobj-js.iife.js.map +1 -1
- package/dist/gobj-js.iife.min.js +1268 -1094
- package/dist/gobj-js.iife.min.js.map +1 -1
- package/dist/gobj-js.umd.js +293 -18
- package/dist/gobj-js.umd.js.map +1 -1
- package/dist/gobj-js.umd.min.js +1266 -1092
- package/dist/gobj-js.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/gobj-js.cjs.js
CHANGED
|
@@ -384,7 +384,7 @@ var Event_Type = class {
|
|
|
384
384
|
}
|
|
385
385
|
};
|
|
386
386
|
function tab() {
|
|
387
|
-
return " ".repeat(Math.max(
|
|
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) {
|
|
@@ -400,6 +400,269 @@ function trace_machine(msg) {
|
|
|
400
400
|
if (is_object(msg)) msg = JSON.stringify(msg);
|
|
401
401
|
log_debug(tab() + String(msg));
|
|
402
402
|
}
|
|
403
|
+
/***************************************************************
|
|
404
|
+
* Trace levels
|
|
405
|
+
*
|
|
406
|
+
* The SAME names and the SAME bits as the C kernel (gobj.h's
|
|
407
|
+
* enum + gobj.c's s_global_trace_level), so a level means one
|
|
408
|
+
* thing across the two implementations and a habit learned on
|
|
409
|
+
* one side transfers to the other. The levels that only exist
|
|
410
|
+
* on a node (fs, liburing, gbuffers) keep their bit anyway:
|
|
411
|
+
* dropping them would shift every bit above and break exactly
|
|
412
|
+
* that alignment.
|
|
413
|
+
*
|
|
414
|
+
* 16 higher bits are global, 16 lower bits are per-gclass user
|
|
415
|
+
* levels (`s_user_trace_level` in gclass_create).
|
|
416
|
+
***************************************************************/
|
|
417
|
+
var trace_level_t = Object.freeze({
|
|
418
|
+
TRACE_MACHINE: 65536,
|
|
419
|
+
TRACE_CREATE_DELETE: 131072,
|
|
420
|
+
TRACE_CREATE_DELETE2: 262144,
|
|
421
|
+
TRACE_SUBSCRIPTIONS: 524288,
|
|
422
|
+
TRACE_START_STOP: 1048576,
|
|
423
|
+
TRACE_EV_KW: 2097152,
|
|
424
|
+
TRACE_AUTHZS: 4194304,
|
|
425
|
+
TRACE_STATES: 8388608,
|
|
426
|
+
TRACE_GBUFFERS: 16777216,
|
|
427
|
+
TRACE_TIMER: 33554432,
|
|
428
|
+
TRACE_FS: 67108864,
|
|
429
|
+
TRACE_URING: 134217728,
|
|
430
|
+
TRACE_TIMER_PERIODIC: 268435456,
|
|
431
|
+
TRACE_URING_TIME: 536870912,
|
|
432
|
+
TRACE_COMMANDS: 1073741824
|
|
433
|
+
});
|
|
434
|
+
var TRACE_GLOBAL_LEVEL1 = 268369920;
|
|
435
|
+
var s_global_trace_level = [
|
|
436
|
+
[
|
|
437
|
+
"machine",
|
|
438
|
+
trace_level_t.TRACE_MACHINE,
|
|
439
|
+
"Trace machine"
|
|
440
|
+
],
|
|
441
|
+
[
|
|
442
|
+
"create_delete",
|
|
443
|
+
trace_level_t.TRACE_CREATE_DELETE,
|
|
444
|
+
"Trace create/delete of gobjs"
|
|
445
|
+
],
|
|
446
|
+
[
|
|
447
|
+
"create_delete2",
|
|
448
|
+
trace_level_t.TRACE_CREATE_DELETE2,
|
|
449
|
+
"Trace create/delete of gobjs level 2: with kw"
|
|
450
|
+
],
|
|
451
|
+
[
|
|
452
|
+
"subscriptions",
|
|
453
|
+
trace_level_t.TRACE_SUBSCRIPTIONS,
|
|
454
|
+
"Trace subscriptions of gobjs"
|
|
455
|
+
],
|
|
456
|
+
[
|
|
457
|
+
"start_stop",
|
|
458
|
+
trace_level_t.TRACE_START_STOP,
|
|
459
|
+
"Trace start/stop of gobjs"
|
|
460
|
+
],
|
|
461
|
+
[
|
|
462
|
+
"ev_kw",
|
|
463
|
+
trace_level_t.TRACE_EV_KW,
|
|
464
|
+
"Trace event keywords"
|
|
465
|
+
],
|
|
466
|
+
[
|
|
467
|
+
"authzs",
|
|
468
|
+
trace_level_t.TRACE_AUTHZS,
|
|
469
|
+
"Trace authorizations"
|
|
470
|
+
],
|
|
471
|
+
[
|
|
472
|
+
"states",
|
|
473
|
+
trace_level_t.TRACE_STATES,
|
|
474
|
+
"Trace change of states"
|
|
475
|
+
],
|
|
476
|
+
[
|
|
477
|
+
"gbuffers",
|
|
478
|
+
trace_level_t.TRACE_GBUFFERS,
|
|
479
|
+
"Trace gbuffers"
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
"timer",
|
|
483
|
+
trace_level_t.TRACE_TIMER,
|
|
484
|
+
"Trace timers"
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"fs",
|
|
488
|
+
trace_level_t.TRACE_FS,
|
|
489
|
+
"Trace file system"
|
|
490
|
+
],
|
|
491
|
+
[
|
|
492
|
+
"liburing",
|
|
493
|
+
trace_level_t.TRACE_URING,
|
|
494
|
+
"Trace liburing mixins"
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
"timer_periodic",
|
|
498
|
+
trace_level_t.TRACE_TIMER_PERIODIC,
|
|
499
|
+
"Trace periodic timers"
|
|
500
|
+
],
|
|
501
|
+
[
|
|
502
|
+
"liburing_timer",
|
|
503
|
+
trace_level_t.TRACE_URING_TIME,
|
|
504
|
+
"Trace liburing timer"
|
|
505
|
+
],
|
|
506
|
+
[
|
|
507
|
+
"commands",
|
|
508
|
+
trace_level_t.TRACE_COMMANDS,
|
|
509
|
+
"Trace commands"
|
|
510
|
+
]
|
|
511
|
+
];
|
|
512
|
+
var __global_trace_level__ = 0;
|
|
513
|
+
var __global_trace_no_level__ = 0;
|
|
514
|
+
var __deep_trace__ = 0;
|
|
515
|
+
function level2bit(level) {
|
|
516
|
+
for (const [name, bit] of s_global_trace_level) if (name === level) return bit;
|
|
517
|
+
return 0;
|
|
518
|
+
}
|
|
519
|
+
function trace_bitmask(level, who) {
|
|
520
|
+
if (empty_string(level)) return TRACE_GLOBAL_LEVEL1;
|
|
521
|
+
if (/^[0-9]+$/.test(String(level))) {
|
|
522
|
+
const n = Number(level);
|
|
523
|
+
if (n) return n;
|
|
524
|
+
}
|
|
525
|
+
const bit = level2bit(String(level));
|
|
526
|
+
if (!bit) {
|
|
527
|
+
log_error(`${who}: trace level NOT FOUND: ${level}`);
|
|
528
|
+
return 0;
|
|
529
|
+
}
|
|
530
|
+
return bit;
|
|
531
|
+
}
|
|
532
|
+
/************************************************************
|
|
533
|
+
* The levels in force for a gobj: global, plus its gclass's,
|
|
534
|
+
* plus its own — the union, exactly as the C kernel computes
|
|
535
|
+
* it in gobj_trace_level().
|
|
536
|
+
************************************************************/
|
|
537
|
+
function gobj_trace_level(gobj) {
|
|
538
|
+
if (__deep_trace__) return 4294967295;
|
|
539
|
+
let bitmask = __global_trace_level__;
|
|
540
|
+
if (gobj) {
|
|
541
|
+
bitmask |= gobj.trace_level || 0;
|
|
542
|
+
if (gobj.gclass) bitmask |= gobj.gclass.trace_level || 0;
|
|
543
|
+
}
|
|
544
|
+
return bitmask;
|
|
545
|
+
}
|
|
546
|
+
function gobj_trace_no_level(gobj) {
|
|
547
|
+
let bitmask = __global_trace_no_level__;
|
|
548
|
+
if (gobj) {
|
|
549
|
+
bitmask |= gobj.no_trace_level || 0;
|
|
550
|
+
if (gobj.gclass) bitmask |= gobj.gclass.no_trace_level || 0;
|
|
551
|
+
}
|
|
552
|
+
return bitmask;
|
|
553
|
+
}
|
|
554
|
+
function legacy_yuno_trace_bits() {
|
|
555
|
+
if (!__yuno__ || !__yuno__.jn_attrs) return 0;
|
|
556
|
+
let bits = 0;
|
|
557
|
+
if (gobj_has_attr(__yuno__, "tracing")) {
|
|
558
|
+
const tracing = Number(gobj_read_attr(__yuno__, "tracing")) || 0;
|
|
559
|
+
if (tracing >= 1) bits |= trace_level_t.TRACE_MACHINE;
|
|
560
|
+
if (tracing >= 2) bits |= trace_level_t.TRACE_EV_KW;
|
|
561
|
+
}
|
|
562
|
+
if (gobj_has_attr(__yuno__, "trace_timer") && gobj_read_attr(__yuno__, "trace_timer")) bits |= trace_level_t.TRACE_TIMER;
|
|
563
|
+
if (gobj_has_attr(__yuno__, "trace_creation") && gobj_read_attr(__yuno__, "trace_creation")) bits |= trace_level_t.TRACE_CREATE_DELETE;
|
|
564
|
+
if (gobj_has_attr(__yuno__, "trace_start_stop") && gobj_read_attr(__yuno__, "trace_start_stop")) bits |= trace_level_t.TRACE_START_STOP;
|
|
565
|
+
return bits;
|
|
566
|
+
}
|
|
567
|
+
function __trace_gobj_create_delete__(gobj) {
|
|
568
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_CREATE_DELETE;
|
|
569
|
+
}
|
|
570
|
+
function __trace_gobj_start_stop__(gobj) {
|
|
571
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_START_STOP;
|
|
572
|
+
}
|
|
573
|
+
function __trace_gobj_ev_kw__(gobj) {
|
|
574
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_EV_KW;
|
|
575
|
+
}
|
|
576
|
+
function __trace_gobj_states__(gobj) {
|
|
577
|
+
return gobj_trace_level(gobj) & trace_level_t.TRACE_STATES;
|
|
578
|
+
}
|
|
579
|
+
/************************************************************
|
|
580
|
+
* Must trace? — the C kernel's is_machine_tracing(), including
|
|
581
|
+
* the two event-specific levels: `timer` and `timer_periodic`
|
|
582
|
+
* light up only for their own event.
|
|
583
|
+
************************************************************/
|
|
584
|
+
function is_machine_tracing(gobj, event) {
|
|
585
|
+
if (__deep_trace__ > 1) return true;
|
|
586
|
+
if (!gobj) return false;
|
|
587
|
+
const level = gobj_trace_level(gobj) | legacy_yuno_trace_bits();
|
|
588
|
+
return level & trace_level_t.TRACE_MACHINE || level & trace_level_t.TRACE_TIMER_PERIODIC && event === "EV_TIMEOUT_PERIODIC" || level & trace_level_t.TRACE_TIMER && event === "EV_TIMEOUT" ? true : false;
|
|
589
|
+
}
|
|
590
|
+
/************************************************************
|
|
591
|
+
* Must NOT trace? Asked of the SOURCE, so a noisy sender can
|
|
592
|
+
* be silenced without turning the destination off.
|
|
593
|
+
************************************************************/
|
|
594
|
+
function is_machine_not_tracing(gobj, event) {
|
|
595
|
+
if (__deep_trace__ > 1) return false;
|
|
596
|
+
if (!gobj) return true;
|
|
597
|
+
const level = gobj_trace_no_level(gobj);
|
|
598
|
+
return level & trace_level_t.TRACE_MACHINE || level & trace_level_t.TRACE_TIMER_PERIODIC && event === "EV_TIMEOUT_PERIODIC" || level & trace_level_t.TRACE_TIMER && event === "EV_TIMEOUT" ? true : false;
|
|
599
|
+
}
|
|
600
|
+
/************************************************************
|
|
601
|
+
* The setters — same signatures as the C kernel
|
|
602
|
+
************************************************************/
|
|
603
|
+
function gobj_set_global_trace(level, set) {
|
|
604
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_trace");
|
|
605
|
+
if (!bitmask) return -1;
|
|
606
|
+
if (set) __global_trace_level__ |= bitmask;
|
|
607
|
+
else __global_trace_level__ &= ~bitmask;
|
|
608
|
+
return 0;
|
|
609
|
+
}
|
|
610
|
+
function gobj_set_global_no_trace(level, set) {
|
|
611
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_no_trace");
|
|
612
|
+
if (!bitmask) return -1;
|
|
613
|
+
if (set) __global_trace_no_level__ |= bitmask;
|
|
614
|
+
else __global_trace_no_level__ &= ~bitmask;
|
|
615
|
+
return 0;
|
|
616
|
+
}
|
|
617
|
+
function gobj_global_trace_level() {
|
|
618
|
+
return __global_trace_level__;
|
|
619
|
+
}
|
|
620
|
+
function gobj_set_deep_trace(value) {
|
|
621
|
+
__deep_trace__ = Number(value) || 0;
|
|
622
|
+
return 0;
|
|
623
|
+
}
|
|
624
|
+
function gobj_set_gclass_trace(gclass, level, set) {
|
|
625
|
+
const gclass_ = is_string(gclass) ? gclass_find_by_name(gclass) : gclass;
|
|
626
|
+
if (!gclass_) {
|
|
627
|
+
log_error(`gobj_set_gclass_trace: gclass NOT FOUND: ${gclass}`);
|
|
628
|
+
return -1;
|
|
629
|
+
}
|
|
630
|
+
const bitmask = trace_bitmask(level, "gobj_set_gclass_trace");
|
|
631
|
+
if (!bitmask) return -1;
|
|
632
|
+
if (set) gclass_.trace_level |= bitmask;
|
|
633
|
+
else gclass_.trace_level &= ~bitmask;
|
|
634
|
+
return 0;
|
|
635
|
+
}
|
|
636
|
+
function gobj_set_gobj_trace(gobj, level, set) {
|
|
637
|
+
if (!gobj) {
|
|
638
|
+
log_error(`gobj_set_gobj_trace: gobj NULL`);
|
|
639
|
+
return -1;
|
|
640
|
+
}
|
|
641
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_trace");
|
|
642
|
+
if (!bitmask) return -1;
|
|
643
|
+
if (set) gobj.trace_level |= bitmask;
|
|
644
|
+
else gobj.trace_level &= ~bitmask;
|
|
645
|
+
return 0;
|
|
646
|
+
}
|
|
647
|
+
function gobj_set_gobj_no_trace(gobj, level, set) {
|
|
648
|
+
if (!gobj) {
|
|
649
|
+
log_error(`gobj_set_gobj_no_trace: gobj NULL`);
|
|
650
|
+
return -1;
|
|
651
|
+
}
|
|
652
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_no_trace");
|
|
653
|
+
if (!bitmask) return -1;
|
|
654
|
+
if (set) gobj.no_trace_level |= bitmask;
|
|
655
|
+
else gobj.no_trace_level &= ~bitmask;
|
|
656
|
+
return 0;
|
|
657
|
+
}
|
|
658
|
+
function gobj_repr_global_trace_levels() {
|
|
659
|
+
return s_global_trace_level.map(([name, bit, description]) => ({
|
|
660
|
+
name,
|
|
661
|
+
bit,
|
|
662
|
+
description,
|
|
663
|
+
set: __global_trace_level__ & bit ? true : false
|
|
664
|
+
}));
|
|
665
|
+
}
|
|
403
666
|
/************************************************************
|
|
404
667
|
* Start up
|
|
405
668
|
************************************************************/
|
|
@@ -1080,7 +1343,7 @@ function gobj_create2(gobj_name, gclass_name, kw, parent, gobj_flag) {
|
|
|
1080
1343
|
let gobj = new GObj(gobj_name, gclass, kw, parent, gobj_flag);
|
|
1081
1344
|
gobj.jn_attrs = sdata_create(gobj, gclass.attrs_table);
|
|
1082
1345
|
for (const [key, value] of Object.entries(gobj.jn_attrs)) if (key in gobj.priv) gobj.priv[key] = value;
|
|
1083
|
-
let trace_creation =
|
|
1346
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1084
1347
|
if (trace_creation) trace_machine(sprintf("💙💙⏩ creating: %s^%s", gclass.gclass_name, gobj_name));
|
|
1085
1348
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_service) _register_service(gobj);
|
|
1086
1349
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_yuno) __yuno__ = gobj;
|
|
@@ -1140,7 +1403,7 @@ function gobj_destroy(gobj) {
|
|
|
1140
1403
|
gobj_stop(gobj);
|
|
1141
1404
|
}
|
|
1142
1405
|
gobj.obflag |= obflag_t.obflag_destroying;
|
|
1143
|
-
let trace_creation =
|
|
1406
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1144
1407
|
if (trace_creation) trace_machine(sprintf("💔💔⏩ destroying: %s", gobj_full_name(gobj)));
|
|
1145
1408
|
let parent = gobj_parent(gobj);
|
|
1146
1409
|
if (parent && parent.gclass.gmt.mt_child_removed) {
|
|
@@ -1190,7 +1453,7 @@ function gobj_start(gobj) {
|
|
|
1190
1453
|
log_error(`${gobj_short_name(gobj)}: GObj DISABLED`);
|
|
1191
1454
|
return -1;
|
|
1192
1455
|
}
|
|
1193
|
-
if (
|
|
1456
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ start: %s", gobj_full_name(gobj)));
|
|
1194
1457
|
gobj.running = true;
|
|
1195
1458
|
let ret = 0;
|
|
1196
1459
|
if (gobj.gclass.gmt.mt_start) ret = gobj.gclass.gmt.mt_start(gobj);
|
|
@@ -1225,7 +1488,7 @@ function gobj_start_tree(gobj) {
|
|
|
1225
1488
|
log_error("gobj NULL or DESTROYED");
|
|
1226
1489
|
return -1;
|
|
1227
1490
|
}
|
|
1228
|
-
if (
|
|
1491
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ ⏺ ⏺ start_tree: %s", gobj_full_name(gobj)));
|
|
1229
1492
|
if (gobj.gclass.gclass_flag & gclass_flag_t.gcflag_manual_start) return 0;
|
|
1230
1493
|
else if (gobj.disabled) return 0;
|
|
1231
1494
|
else if (!gobj.running) gobj_start(gobj);
|
|
@@ -1247,7 +1510,7 @@ function gobj_stop(gobj) {
|
|
|
1247
1510
|
log_warning(`${gobj_short_name(gobj)}: GObj stopping without previous pause`);
|
|
1248
1511
|
gobj_pause(gobj);
|
|
1249
1512
|
}
|
|
1250
|
-
if (
|
|
1513
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ stop: %s", gobj_full_name(gobj)));
|
|
1251
1514
|
gobj.running = false;
|
|
1252
1515
|
let ret = 0;
|
|
1253
1516
|
if (gobj.gclass.gmt.mt_stop) ret = gobj.gclass.gmt.mt_stop(gobj);
|
|
@@ -1275,7 +1538,7 @@ function gobj_stop_tree(gobj) {
|
|
|
1275
1538
|
log_error("gobj NULL or DESTROYED");
|
|
1276
1539
|
return -1;
|
|
1277
1540
|
}
|
|
1278
|
-
if (
|
|
1541
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ ⏹ ⏹ stop_tree: %s", gobj_full_name(gobj)));
|
|
1279
1542
|
if (gobj_is_running(gobj)) gobj_stop(gobj);
|
|
1280
1543
|
return gobj_walk_gobj_children_tree(gobj, walk_type_t.WALK_TOP2BOTTOM, cb_stop_child, 0, 0);
|
|
1281
1544
|
}
|
|
@@ -1302,7 +1565,7 @@ function gobj_play(gobj) {
|
|
|
1302
1565
|
log_error(`${gobj_short_name(gobj)}: Cannot play, start not done`);
|
|
1303
1566
|
return -1;
|
|
1304
1567
|
}
|
|
1305
|
-
if (
|
|
1568
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏯ ⏯ play: %s", gobj_full_name(gobj)));
|
|
1306
1569
|
gobj.playing = true;
|
|
1307
1570
|
let ret = 0;
|
|
1308
1571
|
if (gobj.gclass.gmt.mt_play) {
|
|
@@ -1323,7 +1586,7 @@ function gobj_pause(gobj) {
|
|
|
1323
1586
|
log_error(`${gobj_short_name(gobj)}: GObj NOT PLAYING`);
|
|
1324
1587
|
return -1;
|
|
1325
1588
|
}
|
|
1326
|
-
if (
|
|
1589
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏸ ⏸ pause: %s", gobj_full_name(gobj)));
|
|
1327
1590
|
gobj.playing = false;
|
|
1328
1591
|
if (gobj.gclass.gmt.mt_pause) return gobj.gclass.gmt.mt_pause(gobj);
|
|
1329
1592
|
else return 0;
|
|
@@ -2000,6 +2263,9 @@ function gobj_change_state(gobj, state_name) {
|
|
|
2000
2263
|
}
|
|
2001
2264
|
gobj.last_state = gobj.current_state;
|
|
2002
2265
|
gobj.current_state = new_state;
|
|
2266
|
+
let tracea = is_machine_tracing(gobj, "EV_STATE_CHANGED");
|
|
2267
|
+
let tracea_states = __trace_gobj_states__(gobj) ? true : false;
|
|
2268
|
+
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));
|
|
2003
2269
|
return true;
|
|
2004
2270
|
}
|
|
2005
2271
|
/***************************************************************************
|
|
@@ -2031,7 +2297,7 @@ function gobj_change_parent(gobj, parent) {
|
|
|
2031
2297
|
}
|
|
2032
2298
|
_add_child(parent, gobj);
|
|
2033
2299
|
if (parent.mt_child_added) {
|
|
2034
|
-
if (
|
|
2300
|
+
if (__trace_gobj_create_delete__(gobj)) log_debug(sprintf("👦👦🔵 child_added(%s): %s", gobj_full_name(parent), gobj_short_name(gobj)));
|
|
2035
2301
|
parent.mt_child_added(parent, gobj);
|
|
2036
2302
|
}
|
|
2037
2303
|
return 0;
|
|
@@ -2101,9 +2367,7 @@ function gobj_send_event(dst, event, kw, src) {
|
|
|
2101
2367
|
log_error(`${gobj_short_name(dst)}: current_state NULL`);
|
|
2102
2368
|
return -1;
|
|
2103
2369
|
}
|
|
2104
|
-
let tracea =
|
|
2105
|
-
tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "tracing");
|
|
2106
|
-
if (gobj_gclass_name(src) === "C_TIMER") tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "trace_timer");
|
|
2370
|
+
let tracea = is_machine_tracing(dst, event) && !is_machine_not_tracing(src, event);
|
|
2107
2371
|
__inside__++;
|
|
2108
2372
|
let event_action = _find_event_action(state, event);
|
|
2109
2373
|
if (!event_action) {
|
|
@@ -2132,7 +2396,7 @@ function gobj_send_event(dst, event, kw, src) {
|
|
|
2132
2396
|
trace_machine(sprintf("🔄 mach(%s%s^%s), st: %s, ev: %s%s%s, ac: %s, from(%s%s^%s)", !dst.running ? "!!" : "", gobj_gclass_name(dst), gobj_name(dst), state.state_name, "", event ? event : "", "", action_name, src && !src.running ? "!!" : "", gobj_gclass_name(src), gobj_name(src)));
|
|
2133
2397
|
}
|
|
2134
2398
|
if (kw) {
|
|
2135
|
-
if (
|
|
2399
|
+
if (__trace_gobj_ev_kw__(dst)) {
|
|
2136
2400
|
if (json_object_size(kw)) trace_json(kw);
|
|
2137
2401
|
}
|
|
2138
2402
|
}
|
|
@@ -2679,10 +2943,10 @@ function format_log(format) {
|
|
|
2679
2943
|
function log_error(format) {
|
|
2680
2944
|
let msg = format_log(format);
|
|
2681
2945
|
let hora = current_timestamp();
|
|
2682
|
-
if (f_error) if (f_error ===
|
|
2946
|
+
if (f_error) if (f_error === _console.error) {
|
|
2683
2947
|
if (__console_output_enabled__) f_error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2684
2948
|
} else {
|
|
2685
|
-
if (__console_output_enabled__)
|
|
2949
|
+
if (__console_output_enabled__) _console.error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2686
2950
|
f_error(`${hora} ERROR: ${String(msg)}`);
|
|
2687
2951
|
}
|
|
2688
2952
|
emit_log_callback("error", msg, hora);
|
|
@@ -2690,10 +2954,10 @@ function log_error(format) {
|
|
|
2690
2954
|
function log_warning(format) {
|
|
2691
2955
|
let msg = format_log(format);
|
|
2692
2956
|
let hora = current_timestamp();
|
|
2693
|
-
if (f_warning) if (f_warning ===
|
|
2957
|
+
if (f_warning) if (f_warning === _console.warn) {
|
|
2694
2958
|
if (__console_output_enabled__) f_warning("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2695
2959
|
} else {
|
|
2696
|
-
if (__console_output_enabled__)
|
|
2960
|
+
if (__console_output_enabled__) _console.warn("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2697
2961
|
f_warning(`${hora} WARNING: ${String(msg)}`);
|
|
2698
2962
|
}
|
|
2699
2963
|
emit_log_callback("warning", msg, hora);
|
|
@@ -6294,6 +6558,7 @@ exports.gobj_find_subscriptions = gobj_find_subscriptions;
|
|
|
6294
6558
|
exports.gobj_flag_t = gobj_flag_t;
|
|
6295
6559
|
exports.gobj_full_name = gobj_full_name;
|
|
6296
6560
|
exports.gobj_gclass_name = gobj_gclass_name;
|
|
6561
|
+
exports.gobj_global_trace_level = gobj_global_trace_level;
|
|
6297
6562
|
exports.gobj_has_attr = gobj_has_attr;
|
|
6298
6563
|
exports.gobj_has_event = gobj_has_event;
|
|
6299
6564
|
exports.gobj_has_output_event = gobj_has_output_event;
|
|
@@ -6323,12 +6588,19 @@ exports.gobj_read_integer_attr = gobj_read_integer_attr;
|
|
|
6323
6588
|
exports.gobj_read_pointer_attr = gobj_read_pointer_attr;
|
|
6324
6589
|
exports.gobj_read_str_attr = gobj_read_str_attr;
|
|
6325
6590
|
exports.gobj_remove_persistent_attrs = gobj_remove_persistent_attrs;
|
|
6591
|
+
exports.gobj_repr_global_trace_levels = gobj_repr_global_trace_levels;
|
|
6326
6592
|
exports.gobj_reset_volatil_attrs = gobj_reset_volatil_attrs;
|
|
6327
6593
|
exports.gobj_save_persistent_attrs = gobj_save_persistent_attrs;
|
|
6328
6594
|
exports.gobj_search_path = gobj_search_path;
|
|
6329
6595
|
exports.gobj_send_event = gobj_send_event;
|
|
6330
6596
|
exports.gobj_services = gobj_services;
|
|
6331
6597
|
exports.gobj_set_bottom_gobj = gobj_set_bottom_gobj;
|
|
6598
|
+
exports.gobj_set_deep_trace = gobj_set_deep_trace;
|
|
6599
|
+
exports.gobj_set_gclass_trace = gobj_set_gclass_trace;
|
|
6600
|
+
exports.gobj_set_global_no_trace = gobj_set_global_no_trace;
|
|
6601
|
+
exports.gobj_set_global_trace = gobj_set_global_trace;
|
|
6602
|
+
exports.gobj_set_gobj_no_trace = gobj_set_gobj_no_trace;
|
|
6603
|
+
exports.gobj_set_gobj_trace = gobj_set_gobj_trace;
|
|
6332
6604
|
exports.gobj_set_trace_machine_format = gobj_set_trace_machine_format;
|
|
6333
6605
|
exports.gobj_short_name = gobj_short_name;
|
|
6334
6606
|
exports.gobj_start = gobj_start;
|
|
@@ -6340,7 +6612,9 @@ exports.gobj_stop = gobj_stop;
|
|
|
6340
6612
|
exports.gobj_stop_children = gobj_stop_children;
|
|
6341
6613
|
exports.gobj_stop_tree = gobj_stop_tree;
|
|
6342
6614
|
exports.gobj_subscribe_event = gobj_subscribe_event;
|
|
6615
|
+
exports.gobj_trace_level = gobj_trace_level;
|
|
6343
6616
|
exports.gobj_trace_machine_format = gobj_trace_machine_format;
|
|
6617
|
+
exports.gobj_trace_no_level = gobj_trace_no_level;
|
|
6344
6618
|
exports.gobj_unsubscribe_event = gobj_unsubscribe_event;
|
|
6345
6619
|
exports.gobj_unsubscribe_list = gobj_unsubscribe_list;
|
|
6346
6620
|
exports.gobj_walk_gobj_children = gobj_walk_gobj_children;
|
|
@@ -6459,6 +6733,7 @@ exports.strstr = strstr;
|
|
|
6459
6733
|
exports.template_get_field_desc = template_get_field_desc;
|
|
6460
6734
|
exports.timeTracker = timeTracker;
|
|
6461
6735
|
exports.trace_json = trace_json;
|
|
6736
|
+
exports.trace_level_t = trace_level_t;
|
|
6462
6737
|
exports.trace_msg = trace_msg;
|
|
6463
6738
|
exports.treedb_decoder_fkey = treedb_decoder_fkey;
|
|
6464
6739
|
exports.treedb_decoder_hook = treedb_decoder_hook;
|