implement LogTiming.Microtask, better test timings, breaking options API

This commit is contained in:
2025-07-19 19:47:07 -04:00
parent 5db910ca14
commit 6a7c6eb40b
6 changed files with 82 additions and 48 deletions

25
tests/timing.ts Normal file
View File

@@ -0,0 +1,25 @@
import Logging, {
LoggingConfiguration,
LogTiming,
} from "../mod.ts";
LoggingConfiguration.logTiming = LogTiming.Microtask;
// high-priority logs
const log = new Logging("HTTP", { silent: false });
Deno.serve({ port: 8080, onListen: addr => {
log.n(`Listen information: ${JSON.stringify(addr)}`);
} }, async (req: Request) => {
const url = new URL(req.url);
if (url.pathname.includes('favicon.ico')) return new Response("Not Found", { status: 404 });
log.i("Received request:", url.pathname);
log.d("I/O start");
const res = await fetch("https://httpbin.org/delay/1");
log.d("I/O end");
return new Response(JSON.stringify(await res.json()), { status: 200 });
});