From 933b54b5fcdd9400e21e8e0114bb4c691e830fec Mon Sep 17 00:00:00 2001 From: alvarius Date: Sat, 9 Dec 2023 13:05:24 +0100 Subject: [PATCH] chore(common): log benchmark to stderr (#2047) --- .changeset/fresh-seals-compare.md | 5 +++++ packages/common/src/createBenchmark.ts | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 .changeset/fresh-seals-compare.md diff --git a/.changeset/fresh-seals-compare.md b/.changeset/fresh-seals-compare.md new file mode 100644 index 0000000000..c52b85b20e --- /dev/null +++ b/.changeset/fresh-seals-compare.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/common": patch +--- + +The benchmark util now logs to `stdout` instead of `stderr`. diff --git a/packages/common/src/createBenchmark.ts b/packages/common/src/createBenchmark.ts index 94188d99a1..2da3f77295 100644 --- a/packages/common/src/createBenchmark.ts +++ b/packages/common/src/createBenchmark.ts @@ -1,7 +1,12 @@ import createDebug from "debug"; +const parentDebug = createDebug("mud:benchmark"); + +// Pipe debug output to stdout instead of stderr +parentDebug.log = console.info.bind(console); + export function createBenchmark(namespace: string): (stepName: string) => void { - const debug = createDebug("mud:benchmark:" + namespace); + const debug = parentDebug.extend(namespace); let lastStep = performance.now(); return (stepName: string) => {