Skip to content

Commit

Permalink
chore(common): log benchmark to stderr (#2047)
Browse files Browse the repository at this point in the history
  • Loading branch information
alvrs committed Dec 9, 2023
1 parent 0a3b9b1 commit 933b54b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fresh-seals-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@latticexyz/common": patch
---

The benchmark util now logs to `stdout` instead of `stderr`.
7 changes: 6 additions & 1 deletion packages/common/src/createBenchmark.ts
Original file line number Diff line number Diff line change
@@ -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) => {
Expand Down

0 comments on commit 933b54b

Please sign in to comment.