| author | |
| committer | |
| log | f62bd1c190dd052352816d001adf6cf8c5e274a3 |
| tree | 1ea2734d0785570ff25c86f13de2f85ce3a300ab |
| parent | a465df835ca978dd2cd1d1ac7c75daf5a49f350a |
| signature | Commit is signed but in an unrecognized format. |
3 files changed, 17 insertions(+), 5 deletions(-)
lib/log.ts+15-2| ... | ... | @@ -57,7 +57,15 @@ export interface Scope { |
| 57 | 57 | /** |
| 58 | 58 | * emit a debugging message. this method is in place for compatibility with |
| 59 | 59 | * the `console` API. prefer calling `.log` directly. |
| 60 | * @internal | |
| 60 | * @internalconst hello = Math.random() > 0.5 ? 1 : "meow"; | |
| 61 | ||
| 62 | interface Meow { | |
| 63 | meow: bigint; | |
| 64 | } | |
| 65 | ||
| 66 | const world = hello as Meow; | |
| 67 | ||
| 68 | console.log(world); | |
| 61 | 69 | */ |
| 62 | 70 | debug(...args: unknown[]): void; |
| 63 | 71 | |
| ... | ... | @@ -441,7 +449,12 @@ const logColors = node.process?.stderr.isTTY ?? false; |
| 441 | 449 | |
| 442 | 450 | let formatLine = /* @__PURE__ */ (() => { |
| 443 | 451 | 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 | } | |
| 445 | 458 | return (...args: unknown[]) => |
| 446 | 459 | args.map((arg) => { |
| 447 | 460 | if (typeof arg === "string") return arg; |
lib/log/stack.ts-1| ... | ... | @@ -101,7 +101,6 @@ export function format(error: Error, colors = false): string { |
| 101 | 101 | ) |
| 102 | 102 | .join(""); |
| 103 | 103 | |
| 104 | let frameLines = "[failed to parse stack trace string]"; | |
| 105 | 104 | let frames = parse(error) ?? []; |
| 106 | 105 | if ("Bun" in globalThis) { |
| 107 | 106 | frames = frames.filter((frame) => |
lib/readme.changes.md+2-2| ... | ... | @@ -16,8 +16,8 @@ |
| 16 | 16 | - `log` in Node.js will inject into `console.*` to prevent interweaving logs |
| 17 | 17 | with widget output text. this injection is enabled regardless of if widgets |
| 18 | 18 | 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. | |
| 21 | 21 | |
| 22 | 22 | ## v2 |
| 23 | 23 |