improved cloudflare worker adapter + added docs about different modes

This commit is contained in:
dswbx
2024-12-11 17:09:28 +01:00
parent 10d606f8e9
commit 32459a1562
8 changed files with 413 additions and 278 deletions

View File

@@ -20,11 +20,16 @@ export class DebugLogger {
return this;
}
reset() {
this.last = 0;
return this;
}
log(...args: any[]) {
if (!this._enabled) return this;
const now = performance.now();
const time = Number.parseInt(String(now - this.last));
const time = this.last === 0 ? 0 : Number.parseInt(String(now - this.last));
const indents = " ".repeat(this._context.length);
const context =
this._context.length > 0 ? `[${this._context[this._context.length - 1]}]` : "";