2g 0.3.0 → 0.3.1
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/CHANGELOG.md +7 -0
- package/dist/2g.d.ts +9 -1
- package/dist/2g.js +119 -107
- package/dist/2g.js.map +1 -1
- package/dist/2g.mjs +151 -141
- package/dist/2g.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# 2g
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ⚠️ Fix missing child `_w` IDs on piped events and auto-install in child workers
|
|
8
|
+
Submitted by [@kitten](https://github.com/kitten) (See [#8](https://github.com/kitten/2g/pull/8))
|
|
9
|
+
|
|
3
10
|
## 0.3.0
|
|
4
11
|
|
|
5
12
|
### Minor Changes
|
package/dist/2g.d.ts
CHANGED
|
@@ -27,11 +27,19 @@ interface InstallEventLoggerOptions extends SessionOptions {
|
|
|
27
27
|
session?: boolean;
|
|
28
28
|
debug?: boolean;
|
|
29
29
|
}
|
|
30
|
+
declare function installChildEventLogger(options?: InstallEventLoggerOptions): boolean;
|
|
30
31
|
declare function installEventLogger(
|
|
31
32
|
targetOrOptions?: string | number | InstallEventLoggerOptions
|
|
32
33
|
): void;
|
|
33
34
|
declare const getEventLoggerInfo: () => EventLoggerInfo | null;
|
|
34
35
|
declare function flushEventLogger(): Promise<void>;
|
|
35
36
|
|
|
36
|
-
export {
|
|
37
|
+
export {
|
|
38
|
+
EventLogger,
|
|
39
|
+
events,
|
|
40
|
+
flushEventLogger,
|
|
41
|
+
getEventLoggerInfo,
|
|
42
|
+
installChildEventLogger,
|
|
43
|
+
installEventLogger,
|
|
44
|
+
};
|
|
37
45
|
export type { EventLoggerInfo, InstallEventLoggerOptions };
|
package/dist/2g.js
CHANGED
|
@@ -39,9 +39,9 @@ const d = Array.from({
|
|
|
39
39
|
|
|
40
40
|
let f = -1;
|
|
41
41
|
|
|
42
|
-
let
|
|
42
|
+
let g = "";
|
|
43
43
|
|
|
44
|
-
let
|
|
44
|
+
let p;
|
|
45
45
|
|
|
46
46
|
let y = "";
|
|
47
47
|
|
|
@@ -88,14 +88,14 @@ function stringifyTimestamp() {
|
|
|
88
88
|
const i = Math.floor(e);
|
|
89
89
|
if (i !== f) {
|
|
90
90
|
f = i;
|
|
91
|
-
|
|
91
|
+
g = `${i}`;
|
|
92
92
|
}
|
|
93
|
-
return
|
|
93
|
+
return g + d[1e3 * (e - i) | 0];
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
function stringifyWorkerId(e) {
|
|
97
|
-
if (e !==
|
|
98
|
-
|
|
97
|
+
if (e !== p) {
|
|
98
|
+
p = e;
|
|
99
99
|
y = JSON.stringify(e);
|
|
100
100
|
}
|
|
101
101
|
return y;
|
|
@@ -245,25 +245,25 @@ class LogStream extends c.EventEmitter {
|
|
|
245
245
|
#u="";
|
|
246
246
|
#d=0;
|
|
247
247
|
#f=[];
|
|
248
|
-
#p=0;
|
|
249
248
|
#g=0;
|
|
249
|
+
#p=0;
|
|
250
250
|
#y=0;
|
|
251
251
|
#m=!1;
|
|
252
252
|
#S=!1;
|
|
253
|
-
#
|
|
254
|
-
#
|
|
255
|
-
this.#
|
|
253
|
+
#v;
|
|
254
|
+
#w=(e, t) => {
|
|
255
|
+
this.#E(e, t);
|
|
256
256
|
};
|
|
257
|
-
#
|
|
257
|
+
#_=e => {
|
|
258
258
|
if (null != e) {
|
|
259
|
-
this.#
|
|
259
|
+
this.#k(e);
|
|
260
260
|
} else {
|
|
261
|
-
this.#
|
|
261
|
+
this.#E(null, o.Buffer.byteLength(this.#u));
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
#L=() => {
|
|
265
265
|
this.#S = !1;
|
|
266
|
-
if (!this.#n && !this.#l && (this.#f.length - this.#
|
|
266
|
+
if (!this.#n && !this.#l && (this.#f.length - this.#g > this.#p || this.#u)) {
|
|
267
267
|
this.#b();
|
|
268
268
|
}
|
|
269
269
|
};
|
|
@@ -325,9 +325,9 @@ class LogStream extends c.EventEmitter {
|
|
|
325
325
|
this.#I(this.#t);
|
|
326
326
|
}
|
|
327
327
|
#P(e) {
|
|
328
|
-
if ("EAGAIN" === e.code && null != this.#
|
|
328
|
+
if ("EAGAIN" === e.code && null != this.#v) {
|
|
329
329
|
this.#m = !0;
|
|
330
|
-
this.#
|
|
330
|
+
this.#v(this.#u, this.#_);
|
|
331
331
|
} else if (0 === this.#y) {
|
|
332
332
|
this.#y = 1;
|
|
333
333
|
setImmediate(() => this.#b());
|
|
@@ -336,12 +336,12 @@ class LogStream extends c.EventEmitter {
|
|
|
336
336
|
setTimeout(() => this.#b(), this.#y);
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
-
#
|
|
339
|
+
#E(e, t) {
|
|
340
340
|
if (e) {
|
|
341
341
|
if ("EAGAIN" === e.code || "EBUSY" === e.code) {
|
|
342
342
|
this.#P(e);
|
|
343
343
|
} else {
|
|
344
|
-
this.#
|
|
344
|
+
this.#k(e);
|
|
345
345
|
}
|
|
346
346
|
return;
|
|
347
347
|
}
|
|
@@ -365,7 +365,7 @@ class LogStream extends c.EventEmitter {
|
|
|
365
365
|
} else if (this.#o && !this.#r) {
|
|
366
366
|
this.#n = !1;
|
|
367
367
|
this.#T();
|
|
368
|
-
} else if (this.#f.length - this.#
|
|
368
|
+
} else if (this.#f.length - this.#g > this.#p) {
|
|
369
369
|
this.#b();
|
|
370
370
|
} else if (this.#a) {
|
|
371
371
|
this.#n = !1;
|
|
@@ -406,11 +406,11 @@ class LogStream extends c.EventEmitter {
|
|
|
406
406
|
this.#i = null;
|
|
407
407
|
if (e) {
|
|
408
408
|
this.#h = !1;
|
|
409
|
-
this.#
|
|
409
|
+
this.#k(e);
|
|
410
410
|
} else {
|
|
411
411
|
this.#e = i ?? -1;
|
|
412
412
|
this.#t = t;
|
|
413
|
-
this.#
|
|
413
|
+
this.#v = n;
|
|
414
414
|
this.#h = !1;
|
|
415
415
|
this.#n = !1;
|
|
416
416
|
this.emit("ready");
|
|
@@ -422,7 +422,7 @@ class LogStream extends c.EventEmitter {
|
|
|
422
422
|
}
|
|
423
423
|
if (this.#o) {
|
|
424
424
|
this.#T();
|
|
425
|
-
} else if (!this.#n && this.#f.length - this.#
|
|
425
|
+
} else if (!this.#n && this.#f.length - this.#g > this.#p || this.#c) {
|
|
426
426
|
this.#b();
|
|
427
427
|
}
|
|
428
428
|
}
|
|
@@ -434,9 +434,9 @@ class LogStream extends c.EventEmitter {
|
|
|
434
434
|
return;
|
|
435
435
|
}
|
|
436
436
|
this.#l = !0;
|
|
437
|
-
this.#g = 0;
|
|
438
|
-
this.#f.length = 0;
|
|
439
437
|
this.#p = 0;
|
|
438
|
+
this.#f.length = 0;
|
|
439
|
+
this.#g = 0;
|
|
440
440
|
const onClose = e => {
|
|
441
441
|
if (e) {
|
|
442
442
|
this.emit("error", e);
|
|
@@ -460,7 +460,7 @@ class LogStream extends c.EventEmitter {
|
|
|
460
460
|
}
|
|
461
461
|
});
|
|
462
462
|
}
|
|
463
|
-
#
|
|
463
|
+
#k(e) {
|
|
464
464
|
this.#n = !1;
|
|
465
465
|
if (this.listenerCount("error")) {
|
|
466
466
|
this.emit("error", e);
|
|
@@ -476,22 +476,22 @@ class LogStream extends c.EventEmitter {
|
|
|
476
476
|
#b() {
|
|
477
477
|
this.#n = !0;
|
|
478
478
|
if (!this.#u) {
|
|
479
|
-
const e = this.#f.length - this.#
|
|
480
|
-
if (e > this.#
|
|
481
|
-
this.#u = this.#f[this.#
|
|
482
|
-
while (this.#
|
|
483
|
-
this.#u += this.#f[this.#
|
|
479
|
+
const e = this.#f.length - this.#p;
|
|
480
|
+
if (e > this.#g) {
|
|
481
|
+
this.#u = this.#f[this.#g++] || "";
|
|
482
|
+
while (this.#g < e && this.#u.length < 65536) {
|
|
483
|
+
this.#u += this.#f[this.#g++];
|
|
484
484
|
}
|
|
485
|
-
if (this.#
|
|
485
|
+
if (this.#g === this.#f.length) {
|
|
486
486
|
this.#f.length = 0;
|
|
487
|
-
this.#
|
|
487
|
+
this.#g = 0;
|
|
488
488
|
}
|
|
489
489
|
}
|
|
490
490
|
}
|
|
491
|
-
if (null != this.#
|
|
492
|
-
this.#
|
|
491
|
+
if (null != this.#v && (this.#m || this.#e < 0)) {
|
|
492
|
+
this.#v(this.#u, this.#_);
|
|
493
493
|
} else {
|
|
494
|
-
s.write(this.#e, this.#u, this.#
|
|
494
|
+
s.write(this.#e, this.#u, this.#w);
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
_end() {
|
|
@@ -500,7 +500,7 @@ class LogStream extends c.EventEmitter {
|
|
|
500
500
|
if (this.#h) {
|
|
501
501
|
this.once("ready", () => this._end());
|
|
502
502
|
} else if (!this.#n && this.#e >= 0) {
|
|
503
|
-
if (this.#f.length - this.#
|
|
503
|
+
if (this.#f.length - this.#g > this.#p) {
|
|
504
504
|
this.#b();
|
|
505
505
|
} else {
|
|
506
506
|
this.#T();
|
|
@@ -529,7 +529,7 @@ class LogStream extends c.EventEmitter {
|
|
|
529
529
|
}
|
|
530
530
|
if (this.#n || this.#h) {
|
|
531
531
|
this.#o = !0;
|
|
532
|
-
} else if (this.#f.length - this.#
|
|
532
|
+
} else if (this.#f.length - this.#g > this.#p) {
|
|
533
533
|
this.#o = !0;
|
|
534
534
|
this.#b();
|
|
535
535
|
} else {
|
|
@@ -565,7 +565,7 @@ class LogStream extends c.EventEmitter {
|
|
|
565
565
|
this.once("drain", onDrain);
|
|
566
566
|
this.once("error", onError);
|
|
567
567
|
if (!this.#n) {
|
|
568
|
-
if (this.#f.length - this.#
|
|
568
|
+
if (this.#f.length - this.#g > this.#p || this.#u) {
|
|
569
569
|
this.#b();
|
|
570
570
|
} else {
|
|
571
571
|
process.nextTick(() => this.emit("drain"));
|
|
@@ -588,7 +588,7 @@ class LogStream extends c.EventEmitter {
|
|
|
588
588
|
if (this.#l) {
|
|
589
589
|
return !1;
|
|
590
590
|
}
|
|
591
|
-
if (0 === this.#
|
|
591
|
+
if (0 === this.#p && 10 === e.charCodeAt(e.length - 1)) {
|
|
592
592
|
return this._writeln(e);
|
|
593
593
|
}
|
|
594
594
|
this.#d += e.length;
|
|
@@ -596,24 +596,24 @@ class LogStream extends c.EventEmitter {
|
|
|
596
596
|
let i = -1;
|
|
597
597
|
while ((i = e.indexOf("\n", t)) > -1) {
|
|
598
598
|
const s = e.slice(t, i + 1);
|
|
599
|
-
if (this.#
|
|
599
|
+
if (this.#p > 0) {
|
|
600
600
|
this.#f[this.#f.length - 1] += s;
|
|
601
601
|
} else {
|
|
602
602
|
this.#f.push(s);
|
|
603
603
|
}
|
|
604
|
-
this.#
|
|
604
|
+
this.#p = 0;
|
|
605
605
|
t = ++i;
|
|
606
606
|
}
|
|
607
607
|
if (t < e.length) {
|
|
608
608
|
const i = e.slice(t);
|
|
609
|
-
if (this.#
|
|
609
|
+
if (this.#p > 0) {
|
|
610
610
|
this.#f[this.#f.length - 1] += i;
|
|
611
611
|
} else {
|
|
612
612
|
this.#f.push(e.slice(t));
|
|
613
613
|
}
|
|
614
|
-
this.#
|
|
614
|
+
this.#p = 1;
|
|
615
615
|
}
|
|
616
|
-
if (!this.#n && this.#f.length - this.#
|
|
616
|
+
if (!this.#n && this.#f.length - this.#g > this.#p) {
|
|
617
617
|
this.#$();
|
|
618
618
|
}
|
|
619
619
|
return this.#d < 16384;
|
|
@@ -680,12 +680,12 @@ class SocketSink {
|
|
|
680
680
|
}
|
|
681
681
|
|
|
682
682
|
class BroadcastChannel {
|
|
683
|
-
#
|
|
684
|
-
#
|
|
683
|
+
#C;
|
|
684
|
+
#V=[];
|
|
685
685
|
#l=!1;
|
|
686
686
|
constructor(e) {
|
|
687
|
-
this.#
|
|
688
|
-
this.#
|
|
687
|
+
this.#C = e;
|
|
688
|
+
this.#V.push({
|
|
689
689
|
sink: e,
|
|
690
690
|
dropOnBackpressure: !1,
|
|
691
691
|
destroy: () => e.destroy()
|
|
@@ -695,8 +695,8 @@ class BroadcastChannel {
|
|
|
695
695
|
if (this.#l) {
|
|
696
696
|
return !1;
|
|
697
697
|
}
|
|
698
|
-
for (let e = 0; e < this.#
|
|
699
|
-
if (this.#
|
|
698
|
+
for (let e = 0; e < this.#V.length; e++) {
|
|
699
|
+
if (this.#V[e].sink.writable) {
|
|
700
700
|
return !0;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
@@ -709,7 +709,7 @@ class BroadcastChannel {
|
|
|
709
709
|
if (this.#l) {
|
|
710
710
|
e.destroy();
|
|
711
711
|
} else {
|
|
712
|
-
this.#
|
|
712
|
+
this.#V.push({
|
|
713
713
|
sink: e,
|
|
714
714
|
dropOnBackpressure: !1,
|
|
715
715
|
destroy: () => e.destroy()
|
|
@@ -741,11 +741,11 @@ class BroadcastChannel {
|
|
|
741
741
|
e.destroy();
|
|
742
742
|
}
|
|
743
743
|
};
|
|
744
|
-
this.#
|
|
744
|
+
this.#V.push(i);
|
|
745
745
|
const detach = () => {
|
|
746
|
-
const e = this.#
|
|
746
|
+
const e = this.#V.indexOf(i);
|
|
747
747
|
if (e > -1) {
|
|
748
|
-
this.#
|
|
748
|
+
this.#V.splice(e, 1);
|
|
749
749
|
}
|
|
750
750
|
i.destroy();
|
|
751
751
|
};
|
|
@@ -772,7 +772,7 @@ class BroadcastChannel {
|
|
|
772
772
|
e.on("error", () => {});
|
|
773
773
|
}
|
|
774
774
|
_writeln(e) {
|
|
775
|
-
const t = this.#
|
|
775
|
+
const t = this.#V;
|
|
776
776
|
let i = !1;
|
|
777
777
|
for (let s = t.length - 1; s >= 0; s--) {
|
|
778
778
|
const n = t[s];
|
|
@@ -786,24 +786,24 @@ class BroadcastChannel {
|
|
|
786
786
|
return i;
|
|
787
787
|
}
|
|
788
788
|
flush(e) {
|
|
789
|
-
if (this.#
|
|
790
|
-
this.#
|
|
789
|
+
if (this.#C.flush) {
|
|
790
|
+
this.#C.flush(e);
|
|
791
791
|
} else {
|
|
792
792
|
e();
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
795
|
end(e) {
|
|
796
|
-
for (const t of this.#
|
|
797
|
-
t.sink.end(t.sink === this.#
|
|
796
|
+
for (const t of this.#V) {
|
|
797
|
+
t.sink.end(t.sink === this.#C ? e : void 0);
|
|
798
798
|
}
|
|
799
799
|
return this;
|
|
800
800
|
}
|
|
801
801
|
destroy() {
|
|
802
802
|
this.#l = !0;
|
|
803
|
-
for (const e of this.#
|
|
803
|
+
for (const e of this.#V) {
|
|
804
804
|
e.destroy();
|
|
805
805
|
}
|
|
806
|
-
this.#
|
|
806
|
+
this.#V.length = 0;
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
809
|
|
|
@@ -921,8 +921,8 @@ function createSession(t) {
|
|
|
921
921
|
const u = i.createSocketAddress(l, c, "live");
|
|
922
922
|
const d = i.createSocketAddress(l, c, "ipc");
|
|
923
923
|
const f = new LogStream(e.join(l, "0.jsonl"));
|
|
924
|
-
const
|
|
925
|
-
|
|
924
|
+
const g = new BroadcastChannel(f);
|
|
925
|
+
g.add(createDebugSink());
|
|
926
926
|
!function trackSegmentRotation(t, i, n, r) {
|
|
927
927
|
let o = 0;
|
|
928
928
|
t.on("write", c => {
|
|
@@ -946,11 +946,11 @@ function createSession(t) {
|
|
|
946
946
|
t.reopen();
|
|
947
947
|
});
|
|
948
948
|
}(f, l, h, a);
|
|
949
|
-
const
|
|
950
|
-
const y = n.createServer(e =>
|
|
951
|
-
const m = i.listenSocket(
|
|
949
|
+
const p = n.createServer(e => g.attach(e));
|
|
950
|
+
const y = n.createServer(e => g.ingest(e));
|
|
951
|
+
const m = i.listenSocket(p, u.path);
|
|
952
952
|
const S = i.listenSocket(y, d.path);
|
|
953
|
-
const
|
|
953
|
+
const v = function publishIpcPath(e) {
|
|
954
954
|
process.env[i.INTERNAL_IPC_ENV] = e;
|
|
955
955
|
return () => {
|
|
956
956
|
if (process.env[i.INTERNAL_IPC_ENV] === e) {
|
|
@@ -958,7 +958,7 @@ function createSession(t) {
|
|
|
958
958
|
}
|
|
959
959
|
};
|
|
960
960
|
}(d.path);
|
|
961
|
-
const
|
|
961
|
+
const w = function publishProcessOrigin() {
|
|
962
962
|
const e = String(process.pid);
|
|
963
963
|
process.env[i.INTERNAL_PROCESS_ORIGIN_ENV] = e;
|
|
964
964
|
setLocalProcessOrigin(e);
|
|
@@ -969,7 +969,7 @@ function createSession(t) {
|
|
|
969
969
|
setLocalProcessOrigin(void 0);
|
|
970
970
|
};
|
|
971
971
|
}();
|
|
972
|
-
const
|
|
972
|
+
const E = {
|
|
973
973
|
pid: process.pid,
|
|
974
974
|
formatVersion: i.EVENT_LOG_FORMAT_VERSION,
|
|
975
975
|
startedAt: o,
|
|
@@ -988,19 +988,19 @@ function createSession(t) {
|
|
|
988
988
|
mode: 384
|
|
989
989
|
});
|
|
990
990
|
s.renameSync(i, e);
|
|
991
|
-
}(e.join(l, i.SESSION_FILES.meta),
|
|
991
|
+
}(e.join(l, i.SESSION_FILES.meta), E);
|
|
992
992
|
} catch {}
|
|
993
|
-
let
|
|
993
|
+
let _ = !1;
|
|
994
994
|
const destroy = () => {
|
|
995
|
-
if (
|
|
995
|
+
if (_) {
|
|
996
996
|
return;
|
|
997
997
|
}
|
|
998
|
-
|
|
999
|
-
|
|
998
|
+
_ = !0;
|
|
999
|
+
g.destroy();
|
|
1000
1000
|
m();
|
|
1001
1001
|
S();
|
|
1002
|
-
w();
|
|
1003
1002
|
v();
|
|
1003
|
+
w();
|
|
1004
1004
|
i.removeSocket(u.path);
|
|
1005
1005
|
i.removeSocket(d.path);
|
|
1006
1006
|
};
|
|
@@ -1029,8 +1029,8 @@ function createSession(t) {
|
|
|
1029
1029
|
});
|
|
1030
1030
|
return {
|
|
1031
1031
|
sessionDir: l,
|
|
1032
|
-
meta:
|
|
1033
|
-
sink:
|
|
1032
|
+
meta: E,
|
|
1033
|
+
sink: g,
|
|
1034
1034
|
destroy
|
|
1035
1035
|
};
|
|
1036
1036
|
}
|
|
@@ -1050,7 +1050,41 @@ function createSessionOrigin() {
|
|
|
1050
1050
|
};
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
|
-
const
|
|
1053
|
+
const v = events("root");
|
|
1054
|
+
|
|
1055
|
+
function installChildEventLogger(e) {
|
|
1056
|
+
if (a.primarySink) {
|
|
1057
|
+
return !0;
|
|
1058
|
+
}
|
|
1059
|
+
const t = function getProcessWorkerId() {
|
|
1060
|
+
const e = getProcessOrigin();
|
|
1061
|
+
return e ? `${e.kind}:${e.id}` : void 0;
|
|
1062
|
+
}();
|
|
1063
|
+
if (t) {
|
|
1064
|
+
a.eventMeta = {
|
|
1065
|
+
_w: t
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
const s = function getParentIpcPath() {
|
|
1069
|
+
return process.env[i.INTERNAL_IPC_ENV];
|
|
1070
|
+
}();
|
|
1071
|
+
if (s) {
|
|
1072
|
+
a.debug = e?.debug ?? !!process.env[i.LOG_DEBUG_ENV];
|
|
1073
|
+
!function connectToParent(e) {
|
|
1074
|
+
a.primarySink = createPrimarySink(openIpc(e), {
|
|
1075
|
+
closeFd: !1
|
|
1076
|
+
});
|
|
1077
|
+
a.eventLoggerInfo = {
|
|
1078
|
+
destination: "ipc",
|
|
1079
|
+
isUserVisibleOutput: !1
|
|
1080
|
+
};
|
|
1081
|
+
v("init", getInitMetadata());
|
|
1082
|
+
}(s);
|
|
1083
|
+
return !0;
|
|
1084
|
+
} else {
|
|
1085
|
+
return !1;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1054
1088
|
|
|
1055
1089
|
function parseLogTarget(t) {
|
|
1056
1090
|
if ("number" == typeof t) {
|
|
@@ -1093,9 +1127,11 @@ function getInitMetadata(e) {
|
|
|
1093
1127
|
|
|
1094
1128
|
function activateSink(e, t) {
|
|
1095
1129
|
a.primarySink = e;
|
|
1096
|
-
|
|
1130
|
+
v("init", getInitMetadata(t));
|
|
1097
1131
|
}
|
|
1098
1132
|
|
|
1133
|
+
installChildEventLogger();
|
|
1134
|
+
|
|
1099
1135
|
exports.events = events;
|
|
1100
1136
|
|
|
1101
1137
|
exports.flushEventLogger = function flushEventLogger() {
|
|
@@ -1111,11 +1147,13 @@ exports.flushEventLogger = function flushEventLogger() {
|
|
|
1111
1147
|
|
|
1112
1148
|
exports.getEventLoggerInfo = () => a.primarySink?.writable ? a.eventLoggerInfo : null;
|
|
1113
1149
|
|
|
1150
|
+
exports.installChildEventLogger = installChildEventLogger;
|
|
1151
|
+
|
|
1114
1152
|
exports.installEventLogger = function installEventLogger(e) {
|
|
1115
|
-
|
|
1153
|
+
const t = e && "object" == typeof e ? e : void 0;
|
|
1154
|
+
if (installChildEventLogger(t)) {
|
|
1116
1155
|
return;
|
|
1117
1156
|
}
|
|
1118
|
-
const t = e && "object" == typeof e ? e : void 0;
|
|
1119
1157
|
const s = parseLogTarget(process.env[i.LOG_EVENTS_ENV]) ?? parseLogTarget("string" == typeof e || "number" == typeof e ? e : void 0);
|
|
1120
1158
|
if (null != s) {
|
|
1121
1159
|
if ("number" == typeof s) {
|
|
@@ -1139,32 +1177,6 @@ exports.installEventLogger = function installEventLogger(e) {
|
|
|
1139
1177
|
activateSink(createPrimarySink(s));
|
|
1140
1178
|
return;
|
|
1141
1179
|
}
|
|
1142
|
-
const n = function getParentIpcPath() {
|
|
1143
|
-
return process.env[i.INTERNAL_IPC_ENV];
|
|
1144
|
-
}();
|
|
1145
|
-
if (n) {
|
|
1146
|
-
a.debug = t?.debug ?? !!process.env[i.LOG_DEBUG_ENV];
|
|
1147
|
-
!function connectToParent(e) {
|
|
1148
|
-
const t = function getProcessWorkerId() {
|
|
1149
|
-
const e = getProcessOrigin();
|
|
1150
|
-
return e ? `${e.kind}:${e.id}` : void 0;
|
|
1151
|
-
}();
|
|
1152
|
-
if (t) {
|
|
1153
|
-
a.eventMeta = {
|
|
1154
|
-
_w: t
|
|
1155
|
-
};
|
|
1156
|
-
}
|
|
1157
|
-
a.primarySink = createPrimarySink(openIpc(e), {
|
|
1158
|
-
closeFd: !1
|
|
1159
|
-
});
|
|
1160
|
-
a.eventLoggerInfo = {
|
|
1161
|
-
destination: "ipc",
|
|
1162
|
-
isUserVisibleOutput: !1
|
|
1163
|
-
};
|
|
1164
|
-
w("init", getInitMetadata());
|
|
1165
|
-
}(n);
|
|
1166
|
-
return;
|
|
1167
|
-
}
|
|
1168
1180
|
if (t && !1 !== t.session) {
|
|
1169
1181
|
a.debug = t.debug ?? !!process.env[i.LOG_DEBUG_ENV];
|
|
1170
1182
|
const e = createSession(t);
|