@php-wasm/logger 0.7.18 → 0.7.20
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/index.cjs +3 -2
- package/index.js +107 -101
- package/lib/logger.d.ts +1 -0
- package/package.json +4 -3
package/index.cjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=function(){var e;return typeof process<"u"&&((e=process.release)==null?void 0:e.name)==="node"?"NODE":typeof window<"u"?"WEB":typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope?"WORKER":"NODE"}();if(b==="NODE"){let e=function(t){return new Promise(function(s,o){t.onload=t.onerror=function(n){t.onload=t.onerror=null,n.type==="load"?s(t.result):o(new Error("Failed to read the blob/file"))}})},r=function(){const t=new Uint8Array([1,2,3,4]),o=new File([t],"test").stream();try{return o.getReader({mode:"byob"}),!0}catch{return!1}};if(typeof File>"u"){class t extends Blob{constructor(o,n,i){super(o);let a;i!=null&&i.lastModified&&(a=new Date),(!a||isNaN(a.getFullYear()))&&(a=new Date),this.lastModifiedDate=a,this.lastModified=a.getMilliseconds(),this.name=n||""}}global.File=t}typeof Blob.prototype.arrayBuffer>"u"&&(Blob.prototype.arrayBuffer=function(){const s=new FileReader;return s.readAsArrayBuffer(this),e(s)}),typeof Blob.prototype.text>"u"&&(Blob.prototype.text=function(){const s=new FileReader;return s.readAsText(this),e(s)}),(typeof Blob.prototype.stream>"u"||!r())&&(Blob.prototype.stream=function(){let t=0;const s=this;return new ReadableStream({type:"bytes",autoAllocateChunkSize:512*1024,async pull(o){const n=o.byobRequest.view,a=await s.slice(t,t+n.byteLength).arrayBuffer(),u=new Uint8Array(a);new Uint8Array(n.buffer).set(u);const g=u.byteLength;o.byobRequest.respond(g),t+=g,t>=s.size&&o.close()}})})}if(b==="NODE"&&typeof CustomEvent>"u"){class e extends Event{constructor(t,s={}){super(t,s),this.detail=s.detail}initCustomEvent(){}}globalThis.CustomEvent=e}const v=(e,...r)=>{switch(typeof e.message=="string"?e.message=c(e.message):e.message.message&&typeof e.message.message=="string"&&(e.message.message=c(e.message.message)),e.severity){case"Debug":console.debug(e.message,...r);break;case"Info":console.info(e.message,...r);break;case"Warn":console.warn(e.message,...r);break;case"Error":console.error(e.message,...r);break;case"Fatal":console.error(e.message,...r);break;default:console.log(e.message,...r)}},M=e=>e instanceof Error?[e.message,e.stack].join(`
|
|
2
|
+
`):JSON.stringify(e,null,2),w=[],m=e=>{w.push(e)},d=e=>{if(e.raw===!0)m(e.message);else{const r=L(typeof e.message=="object"?M(e.message):e.message,e.severity??"Info",e.prefix??"JavaScript");m(r)}};class E extends EventTarget{constructor(r=[]){super(),this.handlers=r,this.fatalErrorEvent="playground-fatal-error"}getLogs(){return this.handlers.includes(d)?[...w]:(this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
2
3
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
3
|
-
`),[])}logMessage(
|
|
4
|
+
`),[])}logMessage(r,...t){for(const s of this.handlers)s(r,...t)}log(r,...t){this.logMessage({message:r,severity:void 0,prefix:"JavaScript",raw:!1},...t)}debug(r,...t){this.logMessage({message:r,severity:"Debug",prefix:"JavaScript",raw:!1},...t)}info(r,...t){this.logMessage({message:r,severity:"Info",prefix:"JavaScript",raw:!1},...t)}warn(r,...t){this.logMessage({message:r,severity:"Warn",prefix:"JavaScript",raw:!1},...t)}error(r,...t){this.logMessage({message:r,severity:"Error",prefix:"JavaScript",raw:!1},...t)}}const T=()=>{try{if(process.env.NODE_ENV==="test")return[d]}catch{}return[d,v]},O=new E(T()),c=e=>e.replace(/\t/g,""),L=(e,r,t)=>{const s=new Date,o=new Intl.DateTimeFormat("en-GB",{year:"numeric",month:"short",day:"2-digit",timeZone:"UTC"}).format(s).replace(/ /g,"-"),n=new Intl.DateTimeFormat("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1,timeZone:"UTC",timeZoneName:"short"}).format(s),i=o+" "+n;return e=c(e),`[${i}] ${t} ${r}: ${e}`},P=(e,r)=>{e.addEventListener(e.fatalErrorEvent,r)};let f=0;const p="/wordpress/wp-content/debug.log",S=async e=>await e.fileExists(p)?await e.readFileAsText(p):"",k=(e,r)=>{r.addEventListener("request.end",async()=>{const t=await S(r);if(t.length>f){const s=t.substring(f);e.logMessage({message:s,raw:!0}),f=t.length}}),r.addEventListener("request.error",t=>{t=t,t.error&&(e.logMessage({message:`${t.error.message} ${t.error.stack}`,severity:"Fatal",prefix:t.source==="request"?"PHP":"WASM Crash"}),e.dispatchEvent(new CustomEvent(e.fatalErrorEvent,{detail:{logs:e.getLogs(),source:t.source}})))})},B=(e,r)=>{e.logMessage({message:`${r.message} in ${r.filename} on line ${r.lineno}:${r.colno}`,severity:"Error"})},y=(e,r)=>{if(!(r!=null&&r.reason))return;const t=(r==null?void 0:r.reason.stack)??r.reason;e.logMessage({message:t,severity:"Error"})};let l=0;const x=e=>{navigator.serviceWorker.addEventListener("message",r=>{var t,s,o;((t=r.data)==null?void 0:t.numberOfOpenPlaygroundTabs)!==void 0&&l!==((s=r.data)==null?void 0:s.numberOfOpenPlaygroundTabs)&&(l=(o=r.data)==null?void 0:o.numberOfOpenPlaygroundTabs,e.debug(`Number of open Playground tabs is: ${l}`))})};let h=!1;const D=e=>{h||(x(e),!(typeof window>"u")&&(window.addEventListener("error",r=>B(e,r)),window.addEventListener("unhandledrejection",r=>y(e,r)),window.addEventListener("rejectionhandled",r=>y(e,r)),h=!0))},W=e=>{e.addEventListener("activate",()=>{e.clients.matchAll().then(r=>{const t={numberOfOpenPlaygroundTabs:r.filter(s=>s.frameType==="top-level").length};for(const s of r)s.postMessage(t)})})};exports.Logger=E;exports.addCrashListener=P;exports.collectPhpLogs=k;exports.collectWindowErrors=D;exports.formatLogEntry=L;exports.logger=O;exports.prepareLogMessage=c;exports.reportServiceWorkerMetrics=W;
|
package/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
3
|
-
return typeof process < "u" && ((
|
|
1
|
+
const b = function() {
|
|
2
|
+
var e;
|
|
3
|
+
return typeof process < "u" && ((e = process.release) == null ? void 0 : e.name) === "node" ? "NODE" : typeof window < "u" ? "WEB" : (
|
|
4
4
|
// @ts-ignore
|
|
5
5
|
typeof WorkerGlobalScope < "u" && // @ts-ignore
|
|
6
6
|
self instanceof WorkerGlobalScope ? "WORKER" : "NODE"
|
|
7
7
|
);
|
|
8
8
|
}();
|
|
9
|
-
if (
|
|
10
|
-
let
|
|
9
|
+
if (b === "NODE") {
|
|
10
|
+
let e = function(t) {
|
|
11
11
|
return new Promise(function(s, o) {
|
|
12
12
|
t.onload = t.onerror = function(n) {
|
|
13
13
|
t.onload = t.onerror = null, n.type === "load" ? s(t.result) : o(new Error("Failed to read the blob/file"));
|
|
14
14
|
};
|
|
15
15
|
});
|
|
16
|
-
},
|
|
16
|
+
}, r = function() {
|
|
17
17
|
const t = new Uint8Array([1, 2, 3, 4]), o = new File([t], "test").stream();
|
|
18
18
|
try {
|
|
19
19
|
return o.getReader({ mode: "byob" }), !0;
|
|
@@ -33,11 +33,11 @@ if (p === "NODE") {
|
|
|
33
33
|
}
|
|
34
34
|
typeof Blob.prototype.arrayBuffer > "u" && (Blob.prototype.arrayBuffer = function() {
|
|
35
35
|
const s = new FileReader();
|
|
36
|
-
return s.readAsArrayBuffer(this),
|
|
36
|
+
return s.readAsArrayBuffer(this), e(s);
|
|
37
37
|
}), typeof Blob.prototype.text > "u" && (Blob.prototype.text = function() {
|
|
38
38
|
const s = new FileReader();
|
|
39
|
-
return s.readAsText(this),
|
|
40
|
-
}), (typeof Blob.prototype.stream > "u" || !
|
|
39
|
+
return s.readAsText(this), e(s);
|
|
40
|
+
}), (typeof Blob.prototype.stream > "u" || !r()) && (Blob.prototype.stream = function() {
|
|
41
41
|
let t = 0;
|
|
42
42
|
const s = this;
|
|
43
43
|
return new ReadableStream({
|
|
@@ -49,72 +49,70 @@ if (p === "NODE") {
|
|
|
49
49
|
const n = o.byobRequest.view, a = await s.slice(
|
|
50
50
|
t,
|
|
51
51
|
t + n.byteLength
|
|
52
|
-
).arrayBuffer(),
|
|
53
|
-
new Uint8Array(n.buffer).set(
|
|
54
|
-
const
|
|
55
|
-
o.byobRequest.respond(
|
|
52
|
+
).arrayBuffer(), u = new Uint8Array(a);
|
|
53
|
+
new Uint8Array(n.buffer).set(u);
|
|
54
|
+
const m = u.byteLength;
|
|
55
|
+
o.byobRequest.respond(m), t += m, t >= s.size && o.close();
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
}
|
|
60
|
-
if (
|
|
61
|
-
class
|
|
60
|
+
if (b === "NODE" && typeof CustomEvent > "u") {
|
|
61
|
+
class e extends Event {
|
|
62
62
|
constructor(t, s = {}) {
|
|
63
63
|
super(t, s), this.detail = s.detail;
|
|
64
64
|
}
|
|
65
65
|
initCustomEvent() {
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
|
-
globalThis.CustomEvent =
|
|
68
|
+
globalThis.CustomEvent = e;
|
|
69
69
|
}
|
|
70
|
-
const
|
|
71
|
-
switch (
|
|
70
|
+
const E = (e, ...r) => {
|
|
71
|
+
switch (typeof e.message == "string" ? e.message = l(e.message) : e.message.message && typeof e.message.message == "string" && (e.message.message = l(e.message.message)), e.severity) {
|
|
72
72
|
case "Debug":
|
|
73
|
-
console.debug(
|
|
73
|
+
console.debug(e.message, ...r);
|
|
74
74
|
break;
|
|
75
75
|
case "Info":
|
|
76
|
-
console.info(
|
|
76
|
+
console.info(e.message, ...r);
|
|
77
77
|
break;
|
|
78
78
|
case "Warn":
|
|
79
|
-
console.warn(
|
|
79
|
+
console.warn(e.message, ...r);
|
|
80
80
|
break;
|
|
81
81
|
case "Error":
|
|
82
|
-
console.error(
|
|
82
|
+
console.error(e.message, ...r);
|
|
83
83
|
break;
|
|
84
84
|
case "Fatal":
|
|
85
|
-
console.error(
|
|
85
|
+
console.error(e.message, ...r);
|
|
86
86
|
break;
|
|
87
87
|
default:
|
|
88
|
-
console.log(
|
|
88
|
+
console.log(e.message, ...r);
|
|
89
89
|
}
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (r.raw === !0)
|
|
97
|
-
u(r.message);
|
|
90
|
+
}, v = (e) => e instanceof Error ? [e.message, e.stack].join(`
|
|
91
|
+
`) : JSON.stringify(e, null, 2), w = [], g = (e) => {
|
|
92
|
+
w.push(e);
|
|
93
|
+
}, d = (e) => {
|
|
94
|
+
if (e.raw === !0)
|
|
95
|
+
g(e.message);
|
|
98
96
|
else {
|
|
99
|
-
const
|
|
100
|
-
typeof
|
|
101
|
-
|
|
102
|
-
|
|
97
|
+
const r = T(
|
|
98
|
+
typeof e.message == "object" ? v(e.message) : e.message,
|
|
99
|
+
e.severity ?? "Info",
|
|
100
|
+
e.prefix ?? "JavaScript"
|
|
103
101
|
);
|
|
104
|
-
|
|
102
|
+
g(r);
|
|
105
103
|
}
|
|
106
104
|
};
|
|
107
|
-
class
|
|
105
|
+
class L extends EventTarget {
|
|
108
106
|
// constructor
|
|
109
|
-
constructor(
|
|
110
|
-
super(), this.handlers =
|
|
107
|
+
constructor(r = []) {
|
|
108
|
+
super(), this.handlers = r, this.fatalErrorEvent = "playground-fatal-error";
|
|
111
109
|
}
|
|
112
110
|
/**
|
|
113
111
|
* Get all logs.
|
|
114
112
|
* @returns string[]
|
|
115
113
|
*/
|
|
116
114
|
getLogs() {
|
|
117
|
-
return this.handlers.includes(
|
|
115
|
+
return this.handlers.includes(d) ? [...w] : (this.error(`Logs aren't stored because the logToMemory handler isn't registered.
|
|
118
116
|
If you're using a custom logger instance, make sure to register logToMemory handler.
|
|
119
117
|
`), []);
|
|
120
118
|
}
|
|
@@ -126,9 +124,9 @@ class v extends EventTarget {
|
|
|
126
124
|
* @param raw boolean
|
|
127
125
|
* @param args any
|
|
128
126
|
*/
|
|
129
|
-
logMessage(
|
|
127
|
+
logMessage(r, ...t) {
|
|
130
128
|
for (const s of this.handlers)
|
|
131
|
-
s(
|
|
129
|
+
s(r, ...t);
|
|
132
130
|
}
|
|
133
131
|
/**
|
|
134
132
|
* Log message
|
|
@@ -136,10 +134,10 @@ class v extends EventTarget {
|
|
|
136
134
|
* @param message any
|
|
137
135
|
* @param args any
|
|
138
136
|
*/
|
|
139
|
-
log(
|
|
137
|
+
log(r, ...t) {
|
|
140
138
|
this.logMessage(
|
|
141
139
|
{
|
|
142
|
-
message:
|
|
140
|
+
message: r,
|
|
143
141
|
severity: void 0,
|
|
144
142
|
prefix: "JavaScript",
|
|
145
143
|
raw: !1
|
|
@@ -153,10 +151,10 @@ class v extends EventTarget {
|
|
|
153
151
|
* @param message any
|
|
154
152
|
* @param args any
|
|
155
153
|
*/
|
|
156
|
-
debug(
|
|
154
|
+
debug(r, ...t) {
|
|
157
155
|
this.logMessage(
|
|
158
156
|
{
|
|
159
|
-
message:
|
|
157
|
+
message: r,
|
|
160
158
|
severity: "Debug",
|
|
161
159
|
prefix: "JavaScript",
|
|
162
160
|
raw: !1
|
|
@@ -170,10 +168,10 @@ class v extends EventTarget {
|
|
|
170
168
|
* @param message any
|
|
171
169
|
* @param args any
|
|
172
170
|
*/
|
|
173
|
-
info(
|
|
171
|
+
info(r, ...t) {
|
|
174
172
|
this.logMessage(
|
|
175
173
|
{
|
|
176
|
-
message:
|
|
174
|
+
message: r,
|
|
177
175
|
severity: "Info",
|
|
178
176
|
prefix: "JavaScript",
|
|
179
177
|
raw: !1
|
|
@@ -187,10 +185,10 @@ class v extends EventTarget {
|
|
|
187
185
|
* @param message any
|
|
188
186
|
* @param args any
|
|
189
187
|
*/
|
|
190
|
-
warn(
|
|
188
|
+
warn(r, ...t) {
|
|
191
189
|
this.logMessage(
|
|
192
190
|
{
|
|
193
|
-
message:
|
|
191
|
+
message: r,
|
|
194
192
|
severity: "Warn",
|
|
195
193
|
prefix: "JavaScript",
|
|
196
194
|
raw: !1
|
|
@@ -204,10 +202,10 @@ class v extends EventTarget {
|
|
|
204
202
|
* @param message any
|
|
205
203
|
* @param args any
|
|
206
204
|
*/
|
|
207
|
-
error(
|
|
205
|
+
error(r, ...t) {
|
|
208
206
|
this.logMessage(
|
|
209
207
|
{
|
|
210
|
-
message:
|
|
208
|
+
message: r,
|
|
211
209
|
severity: "Error",
|
|
212
210
|
prefix: "JavaScript",
|
|
213
211
|
raw: !1
|
|
@@ -216,7 +214,14 @@ class v extends EventTarget {
|
|
|
216
214
|
);
|
|
217
215
|
}
|
|
218
216
|
}
|
|
219
|
-
const
|
|
217
|
+
const M = () => {
|
|
218
|
+
try {
|
|
219
|
+
if (process.env.NODE_ENV === "test")
|
|
220
|
+
return [d];
|
|
221
|
+
} catch {
|
|
222
|
+
}
|
|
223
|
+
return [d, E];
|
|
224
|
+
}, k = new L(M()), l = (e) => e.replace(/\t/g, ""), T = (e, r, t) => {
|
|
220
225
|
const s = /* @__PURE__ */ new Date(), o = new Intl.DateTimeFormat("en-GB", {
|
|
221
226
|
year: "numeric",
|
|
222
227
|
month: "short",
|
|
@@ -229,91 +234,92 @@ const B = new v([b, w]), L = (r, e, t) => {
|
|
|
229
234
|
hour12: !1,
|
|
230
235
|
timeZone: "UTC",
|
|
231
236
|
timeZoneName: "short"
|
|
232
|
-
}).format(s);
|
|
233
|
-
return `[${
|
|
234
|
-
},
|
|
235
|
-
|
|
237
|
+
}).format(s), i = o + " " + n;
|
|
238
|
+
return e = l(e), `[${i}] ${t} ${r}: ${e}`;
|
|
239
|
+
}, P = (e, r) => {
|
|
240
|
+
e.addEventListener(e.fatalErrorEvent, r);
|
|
236
241
|
};
|
|
237
|
-
let
|
|
238
|
-
const
|
|
239
|
-
|
|
240
|
-
const t = await
|
|
241
|
-
if (t.length >
|
|
242
|
-
const s = t.substring(
|
|
243
|
-
|
|
242
|
+
let f = 0;
|
|
243
|
+
const p = "/wordpress/wp-content/debug.log", x = async (e) => await e.fileExists(p) ? await e.readFileAsText(p) : "", D = (e, r) => {
|
|
244
|
+
r.addEventListener("request.end", async () => {
|
|
245
|
+
const t = await x(r);
|
|
246
|
+
if (t.length > f) {
|
|
247
|
+
const s = t.substring(f);
|
|
248
|
+
e.logMessage({
|
|
244
249
|
message: s,
|
|
245
250
|
raw: !0
|
|
246
|
-
}),
|
|
251
|
+
}), f = t.length;
|
|
247
252
|
}
|
|
248
|
-
}),
|
|
249
|
-
t = t, t.error && (
|
|
253
|
+
}), r.addEventListener("request.error", (t) => {
|
|
254
|
+
t = t, t.error && (e.logMessage({
|
|
250
255
|
message: `${t.error.message} ${t.error.stack}`,
|
|
251
256
|
severity: "Fatal",
|
|
252
257
|
prefix: t.source === "request" ? "PHP" : "WASM Crash"
|
|
253
|
-
}),
|
|
254
|
-
new CustomEvent(
|
|
258
|
+
}), e.dispatchEvent(
|
|
259
|
+
new CustomEvent(e.fatalErrorEvent, {
|
|
255
260
|
detail: {
|
|
256
|
-
logs:
|
|
261
|
+
logs: e.getLogs(),
|
|
257
262
|
source: t.source
|
|
258
263
|
}
|
|
259
264
|
})
|
|
260
265
|
));
|
|
261
266
|
});
|
|
262
|
-
},
|
|
263
|
-
|
|
264
|
-
message: `${
|
|
267
|
+
}, B = (e, r) => {
|
|
268
|
+
e.logMessage({
|
|
269
|
+
message: `${r.message} in ${r.filename} on line ${r.lineno}:${r.colno}`,
|
|
265
270
|
severity: "Error"
|
|
266
271
|
});
|
|
267
|
-
},
|
|
268
|
-
if (!(
|
|
272
|
+
}, y = (e, r) => {
|
|
273
|
+
if (!(r != null && r.reason))
|
|
269
274
|
return;
|
|
270
|
-
const t = (
|
|
271
|
-
|
|
275
|
+
const t = (r == null ? void 0 : r.reason.stack) ?? r.reason;
|
|
276
|
+
e.logMessage({
|
|
272
277
|
message: t,
|
|
273
278
|
severity: "Error"
|
|
274
279
|
});
|
|
275
280
|
};
|
|
276
|
-
let
|
|
277
|
-
const
|
|
278
|
-
navigator.serviceWorker.addEventListener("message", (
|
|
281
|
+
let c = 0;
|
|
282
|
+
const O = (e) => {
|
|
283
|
+
navigator.serviceWorker.addEventListener("message", (r) => {
|
|
279
284
|
var t, s, o;
|
|
280
|
-
((t =
|
|
281
|
-
`Number of open Playground tabs is: ${
|
|
285
|
+
((t = r.data) == null ? void 0 : t.numberOfOpenPlaygroundTabs) !== void 0 && c !== ((s = r.data) == null ? void 0 : s.numberOfOpenPlaygroundTabs) && (c = (o = r.data) == null ? void 0 : o.numberOfOpenPlaygroundTabs, e.debug(
|
|
286
|
+
`Number of open Playground tabs is: ${c}`
|
|
282
287
|
));
|
|
283
288
|
});
|
|
284
289
|
};
|
|
285
|
-
let
|
|
286
|
-
const S = (
|
|
287
|
-
|
|
290
|
+
let h = !1;
|
|
291
|
+
const S = (e) => {
|
|
292
|
+
h || (O(e), !(typeof window > "u") && (window.addEventListener(
|
|
288
293
|
"error",
|
|
289
|
-
(
|
|
294
|
+
(r) => B(e, r)
|
|
290
295
|
), window.addEventListener(
|
|
291
296
|
"unhandledrejection",
|
|
292
|
-
(
|
|
297
|
+
(r) => y(e, r)
|
|
293
298
|
), window.addEventListener(
|
|
294
299
|
"rejectionhandled",
|
|
295
|
-
(
|
|
296
|
-
),
|
|
297
|
-
},
|
|
298
|
-
|
|
299
|
-
|
|
300
|
+
(r) => y(e, r)
|
|
301
|
+
), h = !0));
|
|
302
|
+
}, F = (e) => {
|
|
303
|
+
e.addEventListener("activate", () => {
|
|
304
|
+
e.clients.matchAll().then((r) => {
|
|
300
305
|
const t = {
|
|
301
|
-
numberOfOpenPlaygroundTabs:
|
|
306
|
+
numberOfOpenPlaygroundTabs: r.filter(
|
|
302
307
|
// Only count top-level frames to get the number of tabs.
|
|
303
308
|
(s) => s.frameType === "top-level"
|
|
304
309
|
).length
|
|
305
310
|
};
|
|
306
|
-
for (const s of
|
|
311
|
+
for (const s of r)
|
|
307
312
|
s.postMessage(t);
|
|
308
313
|
});
|
|
309
314
|
});
|
|
310
315
|
};
|
|
311
316
|
export {
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
317
|
+
L as Logger,
|
|
318
|
+
P as addCrashListener,
|
|
319
|
+
D as collectPhpLogs,
|
|
315
320
|
S as collectWindowErrors,
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
321
|
+
T as formatLogEntry,
|
|
322
|
+
k as logger,
|
|
323
|
+
l as prepareLogMessage,
|
|
324
|
+
F as reportServiceWorkerMetrics
|
|
319
325
|
};
|
package/lib/logger.d.ts
CHANGED
|
@@ -73,6 +73,7 @@ export declare class Logger extends EventTarget {
|
|
|
73
73
|
* The logger instance.
|
|
74
74
|
*/
|
|
75
75
|
export declare const logger: Logger;
|
|
76
|
+
export declare const prepareLogMessage: (message: string) => string;
|
|
76
77
|
export declare const formatLogEntry: (message: string, severity: LogSeverity, prefix: string) => string;
|
|
77
78
|
/**
|
|
78
79
|
* Add a listener for the Playground crashes.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@php-wasm/logger",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.20",
|
|
4
4
|
"description": "A logger for PHP-wasm clients like Playground and WP-now.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,11 +20,12 @@
|
|
|
20
20
|
},
|
|
21
21
|
"license": "GPL-2.0-or-later",
|
|
22
22
|
"type": "module",
|
|
23
|
-
"
|
|
23
|
+
"module": "./index.js",
|
|
24
|
+
"main": "./index.cjs",
|
|
24
25
|
"types": "index.d.ts",
|
|
25
26
|
"engines": {
|
|
26
27
|
"node": ">=18.18.0",
|
|
27
28
|
"npm": ">=8.11.0"
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5915ef756c88da8dcb665f9f0e49ddc0c0b10d50"
|
|
30
31
|
}
|