authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2025-12-23 14:18:14-08:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-01-14 01:08:15-08:00
logf62bd1c190dd052352816d001adf6cf8c5e274a3
tree1ea2734d0785570ff25c86f13de2f85ce3a300ab
parenta465df835ca978dd2cd1d1ac7c75daf5a49f350a
signature Commit is signed but in an unrecognized format.

chore: random lib tidying


3 files changed, 17 insertions(+), 5 deletions(-)

lib/log.ts+15-2
......@@ -57,7 +57,15 @@ export interface Scope {
5757 /**
5858 * emit a debugging message. this method is in place for compatibility with
5959 * the `console` API. prefer calling `.log` directly.
60 * @internal
60 * @internalconst hello = Math.random() > 0.5 ? 1 : "meow";
61
62interface Meow {
63 meow: bigint;
64}
65
66const world = hello as Meow;
67
68console.log(world);
6169 */
6270 debug(...args: unknown[]): void;
6371
......@@ -441,7 +449,12 @@ const logColors = node.process?.stderr.isTTY ?? false;
441449
442450let formatLine = /* @__PURE__ */ (() => {
443451 const fwo = node.builtin("util")?.formatWithOptions;
444 if (fwo) return (...args: unknown[]) => fwo({ colors: logColors }, ...args);
452 if (fwo) {
453 return (...args: unknown[]) => {
454 if (args[0] instanceof Error) return stack.format(args[0], logColors);
455 return fwo({ colors: logColors }, ...args);
456 };
457 }
445458 return (...args: unknown[]) =>
446459 args.map((arg) => {
447460 if (typeof arg === "string") return arg;
lib/log/stack.ts-1
......@@ -101,7 +101,6 @@ export function format(error: Error, colors = false): string {
101101 )
102102 .join("");
103103
104 let frameLines = "[failed to parse stack trace string]";
105104 let frames = parse(error) ?? [];
106105 if ("Bun" in globalThis) {
107106 frames = frames.filter((frame) =>
lib/readme.changes.md+2-2
......@@ -16,8 +16,8 @@
1616- `log` in Node.js will inject into `console.*` to prevent interweaving logs
1717 with widget output text. this injection is enabled regardless of if widgets
1818 are actually running, but do not otherwise change their behavior.
19- `log` scopes render differently in the terminal now
20- `log` in the browser will call the correct
19- `log` scopes render differently in the terminal now.
20- `log` in the browser will call the correct log level function in the browser.
2121
2222## v2
2323