@yuneta/gobj-js 7.9.4 → 7.9.5
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 +292 -17
- 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 +282 -18
- 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 +292 -17
- 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 +292 -17
- 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.umd.js
CHANGED
|
@@ -403,6 +403,269 @@
|
|
|
403
403
|
if (is_object(msg)) msg = JSON.stringify(msg);
|
|
404
404
|
log_debug(tab() + String(msg));
|
|
405
405
|
}
|
|
406
|
+
/***************************************************************
|
|
407
|
+
* Trace levels
|
|
408
|
+
*
|
|
409
|
+
* The SAME names and the SAME bits as the C kernel (gobj.h's
|
|
410
|
+
* enum + gobj.c's s_global_trace_level), so a level means one
|
|
411
|
+
* thing across the two implementations and a habit learned on
|
|
412
|
+
* one side transfers to the other. The levels that only exist
|
|
413
|
+
* on a node (fs, liburing, gbuffers) keep their bit anyway:
|
|
414
|
+
* dropping them would shift every bit above and break exactly
|
|
415
|
+
* that alignment.
|
|
416
|
+
*
|
|
417
|
+
* 16 higher bits are global, 16 lower bits are per-gclass user
|
|
418
|
+
* levels (`s_user_trace_level` in gclass_create).
|
|
419
|
+
***************************************************************/
|
|
420
|
+
var trace_level_t = Object.freeze({
|
|
421
|
+
TRACE_MACHINE: 65536,
|
|
422
|
+
TRACE_CREATE_DELETE: 131072,
|
|
423
|
+
TRACE_CREATE_DELETE2: 262144,
|
|
424
|
+
TRACE_SUBSCRIPTIONS: 524288,
|
|
425
|
+
TRACE_START_STOP: 1048576,
|
|
426
|
+
TRACE_EV_KW: 2097152,
|
|
427
|
+
TRACE_AUTHZS: 4194304,
|
|
428
|
+
TRACE_STATES: 8388608,
|
|
429
|
+
TRACE_GBUFFERS: 16777216,
|
|
430
|
+
TRACE_TIMER: 33554432,
|
|
431
|
+
TRACE_FS: 67108864,
|
|
432
|
+
TRACE_URING: 134217728,
|
|
433
|
+
TRACE_TIMER_PERIODIC: 268435456,
|
|
434
|
+
TRACE_URING_TIME: 536870912,
|
|
435
|
+
TRACE_COMMANDS: 1073741824
|
|
436
|
+
});
|
|
437
|
+
var TRACE_GLOBAL_LEVEL1 = 268369920;
|
|
438
|
+
var s_global_trace_level = [
|
|
439
|
+
[
|
|
440
|
+
"machine",
|
|
441
|
+
trace_level_t.TRACE_MACHINE,
|
|
442
|
+
"Trace machine"
|
|
443
|
+
],
|
|
444
|
+
[
|
|
445
|
+
"create_delete",
|
|
446
|
+
trace_level_t.TRACE_CREATE_DELETE,
|
|
447
|
+
"Trace create/delete of gobjs"
|
|
448
|
+
],
|
|
449
|
+
[
|
|
450
|
+
"create_delete2",
|
|
451
|
+
trace_level_t.TRACE_CREATE_DELETE2,
|
|
452
|
+
"Trace create/delete of gobjs level 2: with kw"
|
|
453
|
+
],
|
|
454
|
+
[
|
|
455
|
+
"subscriptions",
|
|
456
|
+
trace_level_t.TRACE_SUBSCRIPTIONS,
|
|
457
|
+
"Trace subscriptions of gobjs"
|
|
458
|
+
],
|
|
459
|
+
[
|
|
460
|
+
"start_stop",
|
|
461
|
+
trace_level_t.TRACE_START_STOP,
|
|
462
|
+
"Trace start/stop of gobjs"
|
|
463
|
+
],
|
|
464
|
+
[
|
|
465
|
+
"ev_kw",
|
|
466
|
+
trace_level_t.TRACE_EV_KW,
|
|
467
|
+
"Trace event keywords"
|
|
468
|
+
],
|
|
469
|
+
[
|
|
470
|
+
"authzs",
|
|
471
|
+
trace_level_t.TRACE_AUTHZS,
|
|
472
|
+
"Trace authorizations"
|
|
473
|
+
],
|
|
474
|
+
[
|
|
475
|
+
"states",
|
|
476
|
+
trace_level_t.TRACE_STATES,
|
|
477
|
+
"Trace change of states"
|
|
478
|
+
],
|
|
479
|
+
[
|
|
480
|
+
"gbuffers",
|
|
481
|
+
trace_level_t.TRACE_GBUFFERS,
|
|
482
|
+
"Trace gbuffers"
|
|
483
|
+
],
|
|
484
|
+
[
|
|
485
|
+
"timer",
|
|
486
|
+
trace_level_t.TRACE_TIMER,
|
|
487
|
+
"Trace timers"
|
|
488
|
+
],
|
|
489
|
+
[
|
|
490
|
+
"fs",
|
|
491
|
+
trace_level_t.TRACE_FS,
|
|
492
|
+
"Trace file system"
|
|
493
|
+
],
|
|
494
|
+
[
|
|
495
|
+
"liburing",
|
|
496
|
+
trace_level_t.TRACE_URING,
|
|
497
|
+
"Trace liburing mixins"
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
"timer_periodic",
|
|
501
|
+
trace_level_t.TRACE_TIMER_PERIODIC,
|
|
502
|
+
"Trace periodic timers"
|
|
503
|
+
],
|
|
504
|
+
[
|
|
505
|
+
"liburing_timer",
|
|
506
|
+
trace_level_t.TRACE_URING_TIME,
|
|
507
|
+
"Trace liburing timer"
|
|
508
|
+
],
|
|
509
|
+
[
|
|
510
|
+
"commands",
|
|
511
|
+
trace_level_t.TRACE_COMMANDS,
|
|
512
|
+
"Trace commands"
|
|
513
|
+
]
|
|
514
|
+
];
|
|
515
|
+
var __global_trace_level__ = 0;
|
|
516
|
+
var __global_trace_no_level__ = 0;
|
|
517
|
+
var __deep_trace__ = 0;
|
|
518
|
+
function level2bit(level) {
|
|
519
|
+
for (const [name, bit] of s_global_trace_level) if (name === level) return bit;
|
|
520
|
+
return 0;
|
|
521
|
+
}
|
|
522
|
+
function trace_bitmask(level, who) {
|
|
523
|
+
if (empty_string(level)) return TRACE_GLOBAL_LEVEL1;
|
|
524
|
+
if (/^[0-9]+$/.test(String(level))) {
|
|
525
|
+
const n = Number(level);
|
|
526
|
+
if (n) return n;
|
|
527
|
+
}
|
|
528
|
+
const bit = level2bit(String(level));
|
|
529
|
+
if (!bit) {
|
|
530
|
+
log_error(`${who}: trace level NOT FOUND: ${level}`);
|
|
531
|
+
return 0;
|
|
532
|
+
}
|
|
533
|
+
return bit;
|
|
534
|
+
}
|
|
535
|
+
/************************************************************
|
|
536
|
+
* The levels in force for a gobj: global, plus its gclass's,
|
|
537
|
+
* plus its own — the union, exactly as the C kernel computes
|
|
538
|
+
* it in gobj_trace_level().
|
|
539
|
+
************************************************************/
|
|
540
|
+
function gobj_trace_level(gobj) {
|
|
541
|
+
if (__deep_trace__) return 4294967295;
|
|
542
|
+
let bitmask = __global_trace_level__;
|
|
543
|
+
if (gobj) {
|
|
544
|
+
bitmask |= gobj.trace_level || 0;
|
|
545
|
+
if (gobj.gclass) bitmask |= gobj.gclass.trace_level || 0;
|
|
546
|
+
}
|
|
547
|
+
return bitmask;
|
|
548
|
+
}
|
|
549
|
+
function gobj_trace_no_level(gobj) {
|
|
550
|
+
let bitmask = __global_trace_no_level__;
|
|
551
|
+
if (gobj) {
|
|
552
|
+
bitmask |= gobj.no_trace_level || 0;
|
|
553
|
+
if (gobj.gclass) bitmask |= gobj.gclass.no_trace_level || 0;
|
|
554
|
+
}
|
|
555
|
+
return bitmask;
|
|
556
|
+
}
|
|
557
|
+
function legacy_yuno_trace_bits() {
|
|
558
|
+
if (!__yuno__ || !__yuno__.jn_attrs) return 0;
|
|
559
|
+
let bits = 0;
|
|
560
|
+
if (gobj_has_attr(__yuno__, "tracing")) {
|
|
561
|
+
const tracing = Number(gobj_read_attr(__yuno__, "tracing")) || 0;
|
|
562
|
+
if (tracing >= 1) bits |= trace_level_t.TRACE_MACHINE;
|
|
563
|
+
if (tracing >= 2) bits |= trace_level_t.TRACE_EV_KW;
|
|
564
|
+
}
|
|
565
|
+
if (gobj_has_attr(__yuno__, "trace_timer") && gobj_read_attr(__yuno__, "trace_timer")) bits |= trace_level_t.TRACE_TIMER;
|
|
566
|
+
if (gobj_has_attr(__yuno__, "trace_creation") && gobj_read_attr(__yuno__, "trace_creation")) bits |= trace_level_t.TRACE_CREATE_DELETE;
|
|
567
|
+
if (gobj_has_attr(__yuno__, "trace_start_stop") && gobj_read_attr(__yuno__, "trace_start_stop")) bits |= trace_level_t.TRACE_START_STOP;
|
|
568
|
+
return bits;
|
|
569
|
+
}
|
|
570
|
+
function __trace_gobj_create_delete__(gobj) {
|
|
571
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_CREATE_DELETE;
|
|
572
|
+
}
|
|
573
|
+
function __trace_gobj_start_stop__(gobj) {
|
|
574
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_START_STOP;
|
|
575
|
+
}
|
|
576
|
+
function __trace_gobj_ev_kw__(gobj) {
|
|
577
|
+
return (gobj_trace_level(gobj) | legacy_yuno_trace_bits()) & trace_level_t.TRACE_EV_KW;
|
|
578
|
+
}
|
|
579
|
+
function __trace_gobj_states__(gobj) {
|
|
580
|
+
return gobj_trace_level(gobj) & trace_level_t.TRACE_STATES;
|
|
581
|
+
}
|
|
582
|
+
/************************************************************
|
|
583
|
+
* Must trace? — the C kernel's is_machine_tracing(), including
|
|
584
|
+
* the two event-specific levels: `timer` and `timer_periodic`
|
|
585
|
+
* light up only for their own event.
|
|
586
|
+
************************************************************/
|
|
587
|
+
function is_machine_tracing(gobj, event) {
|
|
588
|
+
if (__deep_trace__ > 1) return true;
|
|
589
|
+
if (!gobj) return false;
|
|
590
|
+
const level = gobj_trace_level(gobj) | legacy_yuno_trace_bits();
|
|
591
|
+
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;
|
|
592
|
+
}
|
|
593
|
+
/************************************************************
|
|
594
|
+
* Must NOT trace? Asked of the SOURCE, so a noisy sender can
|
|
595
|
+
* be silenced without turning the destination off.
|
|
596
|
+
************************************************************/
|
|
597
|
+
function is_machine_not_tracing(gobj, event) {
|
|
598
|
+
if (__deep_trace__ > 1) return false;
|
|
599
|
+
if (!gobj) return true;
|
|
600
|
+
const level = gobj_trace_no_level(gobj);
|
|
601
|
+
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;
|
|
602
|
+
}
|
|
603
|
+
/************************************************************
|
|
604
|
+
* The setters — same signatures as the C kernel
|
|
605
|
+
************************************************************/
|
|
606
|
+
function gobj_set_global_trace(level, set) {
|
|
607
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_trace");
|
|
608
|
+
if (!bitmask) return -1;
|
|
609
|
+
if (set) __global_trace_level__ |= bitmask;
|
|
610
|
+
else __global_trace_level__ &= ~bitmask;
|
|
611
|
+
return 0;
|
|
612
|
+
}
|
|
613
|
+
function gobj_set_global_no_trace(level, set) {
|
|
614
|
+
const bitmask = trace_bitmask(level, "gobj_set_global_no_trace");
|
|
615
|
+
if (!bitmask) return -1;
|
|
616
|
+
if (set) __global_trace_no_level__ |= bitmask;
|
|
617
|
+
else __global_trace_no_level__ &= ~bitmask;
|
|
618
|
+
return 0;
|
|
619
|
+
}
|
|
620
|
+
function gobj_global_trace_level() {
|
|
621
|
+
return __global_trace_level__;
|
|
622
|
+
}
|
|
623
|
+
function gobj_set_deep_trace(value) {
|
|
624
|
+
__deep_trace__ = Number(value) || 0;
|
|
625
|
+
return 0;
|
|
626
|
+
}
|
|
627
|
+
function gobj_set_gclass_trace(gclass, level, set) {
|
|
628
|
+
const gclass_ = is_string(gclass) ? gclass_find_by_name(gclass) : gclass;
|
|
629
|
+
if (!gclass_) {
|
|
630
|
+
log_error(`gobj_set_gclass_trace: gclass NOT FOUND: ${gclass}`);
|
|
631
|
+
return -1;
|
|
632
|
+
}
|
|
633
|
+
const bitmask = trace_bitmask(level, "gobj_set_gclass_trace");
|
|
634
|
+
if (!bitmask) return -1;
|
|
635
|
+
if (set) gclass_.trace_level |= bitmask;
|
|
636
|
+
else gclass_.trace_level &= ~bitmask;
|
|
637
|
+
return 0;
|
|
638
|
+
}
|
|
639
|
+
function gobj_set_gobj_trace(gobj, level, set) {
|
|
640
|
+
if (!gobj) {
|
|
641
|
+
log_error(`gobj_set_gobj_trace: gobj NULL`);
|
|
642
|
+
return -1;
|
|
643
|
+
}
|
|
644
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_trace");
|
|
645
|
+
if (!bitmask) return -1;
|
|
646
|
+
if (set) gobj.trace_level |= bitmask;
|
|
647
|
+
else gobj.trace_level &= ~bitmask;
|
|
648
|
+
return 0;
|
|
649
|
+
}
|
|
650
|
+
function gobj_set_gobj_no_trace(gobj, level, set) {
|
|
651
|
+
if (!gobj) {
|
|
652
|
+
log_error(`gobj_set_gobj_no_trace: gobj NULL`);
|
|
653
|
+
return -1;
|
|
654
|
+
}
|
|
655
|
+
const bitmask = trace_bitmask(level, "gobj_set_gobj_no_trace");
|
|
656
|
+
if (!bitmask) return -1;
|
|
657
|
+
if (set) gobj.no_trace_level |= bitmask;
|
|
658
|
+
else gobj.no_trace_level &= ~bitmask;
|
|
659
|
+
return 0;
|
|
660
|
+
}
|
|
661
|
+
function gobj_repr_global_trace_levels() {
|
|
662
|
+
return s_global_trace_level.map(([name, bit, description]) => ({
|
|
663
|
+
name,
|
|
664
|
+
bit,
|
|
665
|
+
description,
|
|
666
|
+
set: __global_trace_level__ & bit ? true : false
|
|
667
|
+
}));
|
|
668
|
+
}
|
|
406
669
|
/************************************************************
|
|
407
670
|
* Start up
|
|
408
671
|
************************************************************/
|
|
@@ -1083,7 +1346,7 @@
|
|
|
1083
1346
|
let gobj = new GObj(gobj_name, gclass, kw, parent, gobj_flag);
|
|
1084
1347
|
gobj.jn_attrs = sdata_create(gobj, gclass.attrs_table);
|
|
1085
1348
|
for (const [key, value] of Object.entries(gobj.jn_attrs)) if (key in gobj.priv) gobj.priv[key] = value;
|
|
1086
|
-
let trace_creation =
|
|
1349
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1087
1350
|
if (trace_creation) trace_machine(sprintf("💙💙⏩ creating: %s^%s", gclass.gclass_name, gobj_name));
|
|
1088
1351
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_service) _register_service(gobj);
|
|
1089
1352
|
if (gobj.gobj_flag & gobj_flag_t.gobj_flag_yuno) __yuno__ = gobj;
|
|
@@ -1143,7 +1406,7 @@
|
|
|
1143
1406
|
gobj_stop(gobj);
|
|
1144
1407
|
}
|
|
1145
1408
|
gobj.obflag |= obflag_t.obflag_destroying;
|
|
1146
|
-
let trace_creation =
|
|
1409
|
+
let trace_creation = __trace_gobj_create_delete__(gobj);
|
|
1147
1410
|
if (trace_creation) trace_machine(sprintf("💔💔⏩ destroying: %s", gobj_full_name(gobj)));
|
|
1148
1411
|
let parent = gobj_parent(gobj);
|
|
1149
1412
|
if (parent && parent.gclass.gmt.mt_child_removed) {
|
|
@@ -1193,7 +1456,7 @@
|
|
|
1193
1456
|
log_error(`${gobj_short_name(gobj)}: GObj DISABLED`);
|
|
1194
1457
|
return -1;
|
|
1195
1458
|
}
|
|
1196
|
-
if (
|
|
1459
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ start: %s", gobj_full_name(gobj)));
|
|
1197
1460
|
gobj.running = true;
|
|
1198
1461
|
let ret = 0;
|
|
1199
1462
|
if (gobj.gclass.gmt.mt_start) ret = gobj.gclass.gmt.mt_start(gobj);
|
|
@@ -1228,7 +1491,7 @@
|
|
|
1228
1491
|
log_error("gobj NULL or DESTROYED");
|
|
1229
1492
|
return -1;
|
|
1230
1493
|
}
|
|
1231
|
-
if (
|
|
1494
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏺ ⏺ ⏺ ⏺ start_tree: %s", gobj_full_name(gobj)));
|
|
1232
1495
|
if (gobj.gclass.gclass_flag & gclass_flag_t.gcflag_manual_start) return 0;
|
|
1233
1496
|
else if (gobj.disabled) return 0;
|
|
1234
1497
|
else if (!gobj.running) gobj_start(gobj);
|
|
@@ -1250,7 +1513,7 @@
|
|
|
1250
1513
|
log_warning(`${gobj_short_name(gobj)}: GObj stopping without previous pause`);
|
|
1251
1514
|
gobj_pause(gobj);
|
|
1252
1515
|
}
|
|
1253
|
-
if (
|
|
1516
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ stop: %s", gobj_full_name(gobj)));
|
|
1254
1517
|
gobj.running = false;
|
|
1255
1518
|
let ret = 0;
|
|
1256
1519
|
if (gobj.gclass.gmt.mt_stop) ret = gobj.gclass.gmt.mt_stop(gobj);
|
|
@@ -1278,7 +1541,7 @@
|
|
|
1278
1541
|
log_error("gobj NULL or DESTROYED");
|
|
1279
1542
|
return -1;
|
|
1280
1543
|
}
|
|
1281
|
-
if (
|
|
1544
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏹ ⏹ ⏹ ⏹ stop_tree: %s", gobj_full_name(gobj)));
|
|
1282
1545
|
if (gobj_is_running(gobj)) gobj_stop(gobj);
|
|
1283
1546
|
return gobj_walk_gobj_children_tree(gobj, walk_type_t.WALK_TOP2BOTTOM, cb_stop_child, 0, 0);
|
|
1284
1547
|
}
|
|
@@ -1305,7 +1568,7 @@
|
|
|
1305
1568
|
log_error(`${gobj_short_name(gobj)}: Cannot play, start not done`);
|
|
1306
1569
|
return -1;
|
|
1307
1570
|
}
|
|
1308
|
-
if (
|
|
1571
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏯ ⏯ play: %s", gobj_full_name(gobj)));
|
|
1309
1572
|
gobj.playing = true;
|
|
1310
1573
|
let ret = 0;
|
|
1311
1574
|
if (gobj.gclass.gmt.mt_play) {
|
|
@@ -1326,7 +1589,7 @@
|
|
|
1326
1589
|
log_error(`${gobj_short_name(gobj)}: GObj NOT PLAYING`);
|
|
1327
1590
|
return -1;
|
|
1328
1591
|
}
|
|
1329
|
-
if (
|
|
1592
|
+
if (__trace_gobj_start_stop__(gobj)) trace_machine(sprintf("⏸ ⏸ pause: %s", gobj_full_name(gobj)));
|
|
1330
1593
|
gobj.playing = false;
|
|
1331
1594
|
if (gobj.gclass.gmt.mt_pause) return gobj.gclass.gmt.mt_pause(gobj);
|
|
1332
1595
|
else return 0;
|
|
@@ -2003,6 +2266,9 @@
|
|
|
2003
2266
|
}
|
|
2004
2267
|
gobj.last_state = gobj.current_state;
|
|
2005
2268
|
gobj.current_state = new_state;
|
|
2269
|
+
let tracea = is_machine_tracing(gobj, "EV_STATE_CHANGED");
|
|
2270
|
+
let tracea_states = __trace_gobj_states__(gobj) ? true : false;
|
|
2271
|
+
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));
|
|
2006
2272
|
return true;
|
|
2007
2273
|
}
|
|
2008
2274
|
/***************************************************************************
|
|
@@ -2034,7 +2300,7 @@
|
|
|
2034
2300
|
}
|
|
2035
2301
|
_add_child(parent, gobj);
|
|
2036
2302
|
if (parent.mt_child_added) {
|
|
2037
|
-
if (
|
|
2303
|
+
if (__trace_gobj_create_delete__(gobj)) log_debug(sprintf("👦👦🔵 child_added(%s): %s", gobj_full_name(parent), gobj_short_name(gobj)));
|
|
2038
2304
|
parent.mt_child_added(parent, gobj);
|
|
2039
2305
|
}
|
|
2040
2306
|
return 0;
|
|
@@ -2104,9 +2370,7 @@
|
|
|
2104
2370
|
log_error(`${gobj_short_name(dst)}: current_state NULL`);
|
|
2105
2371
|
return -1;
|
|
2106
2372
|
}
|
|
2107
|
-
let tracea =
|
|
2108
|
-
tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "tracing");
|
|
2109
|
-
if (gobj_gclass_name(src) === "C_TIMER") tracea = __yuno__ && gobj_read_integer_attr(__yuno__, "trace_timer");
|
|
2373
|
+
let tracea = is_machine_tracing(dst, event) && !is_machine_not_tracing(src, event);
|
|
2110
2374
|
__inside__++;
|
|
2111
2375
|
let event_action = _find_event_action(state, event);
|
|
2112
2376
|
if (!event_action) {
|
|
@@ -2135,7 +2399,7 @@
|
|
|
2135
2399
|
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)));
|
|
2136
2400
|
}
|
|
2137
2401
|
if (kw) {
|
|
2138
|
-
if (
|
|
2402
|
+
if (__trace_gobj_ev_kw__(dst)) {
|
|
2139
2403
|
if (json_object_size(kw)) trace_json(kw);
|
|
2140
2404
|
}
|
|
2141
2405
|
}
|
|
@@ -2682,10 +2946,10 @@
|
|
|
2682
2946
|
function log_error(format) {
|
|
2683
2947
|
let msg = format_log(format);
|
|
2684
2948
|
let hora = current_timestamp();
|
|
2685
|
-
if (f_error) if (f_error ===
|
|
2949
|
+
if (f_error) if (f_error === _console.error) {
|
|
2686
2950
|
if (__console_output_enabled__) f_error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2687
2951
|
} else {
|
|
2688
|
-
if (__console_output_enabled__)
|
|
2952
|
+
if (__console_output_enabled__) _console.error("%c" + hora + " ERROR: " + String(msg), "color:red");
|
|
2689
2953
|
f_error(`${hora} ERROR: ${String(msg)}`);
|
|
2690
2954
|
}
|
|
2691
2955
|
emit_log_callback("error", msg, hora);
|
|
@@ -2693,10 +2957,10 @@
|
|
|
2693
2957
|
function log_warning(format) {
|
|
2694
2958
|
let msg = format_log(format);
|
|
2695
2959
|
let hora = current_timestamp();
|
|
2696
|
-
if (f_warning) if (f_warning ===
|
|
2960
|
+
if (f_warning) if (f_warning === _console.warn) {
|
|
2697
2961
|
if (__console_output_enabled__) f_warning("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2698
2962
|
} else {
|
|
2699
|
-
if (__console_output_enabled__)
|
|
2963
|
+
if (__console_output_enabled__) _console.warn("%c" + hora + " WARNING: " + String(msg), "color:yellow");
|
|
2700
2964
|
f_warning(`${hora} WARNING: ${String(msg)}`);
|
|
2701
2965
|
}
|
|
2702
2966
|
emit_log_callback("warning", msg, hora);
|
|
@@ -6297,6 +6561,7 @@
|
|
|
6297
6561
|
exports.gobj_flag_t = gobj_flag_t;
|
|
6298
6562
|
exports.gobj_full_name = gobj_full_name;
|
|
6299
6563
|
exports.gobj_gclass_name = gobj_gclass_name;
|
|
6564
|
+
exports.gobj_global_trace_level = gobj_global_trace_level;
|
|
6300
6565
|
exports.gobj_has_attr = gobj_has_attr;
|
|
6301
6566
|
exports.gobj_has_event = gobj_has_event;
|
|
6302
6567
|
exports.gobj_has_output_event = gobj_has_output_event;
|
|
@@ -6326,12 +6591,19 @@
|
|
|
6326
6591
|
exports.gobj_read_pointer_attr = gobj_read_pointer_attr;
|
|
6327
6592
|
exports.gobj_read_str_attr = gobj_read_str_attr;
|
|
6328
6593
|
exports.gobj_remove_persistent_attrs = gobj_remove_persistent_attrs;
|
|
6594
|
+
exports.gobj_repr_global_trace_levels = gobj_repr_global_trace_levels;
|
|
6329
6595
|
exports.gobj_reset_volatil_attrs = gobj_reset_volatil_attrs;
|
|
6330
6596
|
exports.gobj_save_persistent_attrs = gobj_save_persistent_attrs;
|
|
6331
6597
|
exports.gobj_search_path = gobj_search_path;
|
|
6332
6598
|
exports.gobj_send_event = gobj_send_event;
|
|
6333
6599
|
exports.gobj_services = gobj_services;
|
|
6334
6600
|
exports.gobj_set_bottom_gobj = gobj_set_bottom_gobj;
|
|
6601
|
+
exports.gobj_set_deep_trace = gobj_set_deep_trace;
|
|
6602
|
+
exports.gobj_set_gclass_trace = gobj_set_gclass_trace;
|
|
6603
|
+
exports.gobj_set_global_no_trace = gobj_set_global_no_trace;
|
|
6604
|
+
exports.gobj_set_global_trace = gobj_set_global_trace;
|
|
6605
|
+
exports.gobj_set_gobj_no_trace = gobj_set_gobj_no_trace;
|
|
6606
|
+
exports.gobj_set_gobj_trace = gobj_set_gobj_trace;
|
|
6335
6607
|
exports.gobj_set_trace_machine_format = gobj_set_trace_machine_format;
|
|
6336
6608
|
exports.gobj_short_name = gobj_short_name;
|
|
6337
6609
|
exports.gobj_start = gobj_start;
|
|
@@ -6343,7 +6615,9 @@
|
|
|
6343
6615
|
exports.gobj_stop_children = gobj_stop_children;
|
|
6344
6616
|
exports.gobj_stop_tree = gobj_stop_tree;
|
|
6345
6617
|
exports.gobj_subscribe_event = gobj_subscribe_event;
|
|
6618
|
+
exports.gobj_trace_level = gobj_trace_level;
|
|
6346
6619
|
exports.gobj_trace_machine_format = gobj_trace_machine_format;
|
|
6620
|
+
exports.gobj_trace_no_level = gobj_trace_no_level;
|
|
6347
6621
|
exports.gobj_unsubscribe_event = gobj_unsubscribe_event;
|
|
6348
6622
|
exports.gobj_unsubscribe_list = gobj_unsubscribe_list;
|
|
6349
6623
|
exports.gobj_walk_gobj_children = gobj_walk_gobj_children;
|
|
@@ -6462,6 +6736,7 @@
|
|
|
6462
6736
|
exports.template_get_field_desc = template_get_field_desc;
|
|
6463
6737
|
exports.timeTracker = timeTracker;
|
|
6464
6738
|
exports.trace_json = trace_json;
|
|
6739
|
+
exports.trace_level_t = trace_level_t;
|
|
6465
6740
|
exports.trace_msg = trace_msg;
|
|
6466
6741
|
exports.treedb_decoder_fkey = treedb_decoder_fkey;
|
|
6467
6742
|
exports.treedb_decoder_hook = treedb_decoder_hook;
|