-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61693b7
commit ee20213
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { logger as lLogger } from "@libp2p/logger"; | ||
import * as B from "tinybench"; | ||
import { logger as pLogger } from "../src/index.js"; | ||
|
||
//node --loader ts-node/esm ./benchmark/index.ts | ||
|
||
let libp2pLogger = lLogger("test"); | ||
libp2pLogger.error("Error works as expected from libp2p"); | ||
let peerbitLogger = pLogger({ module: "test" }); | ||
peerbitLogger.level = "error"; | ||
peerbitLogger.error("Error works as expected Peerbit!"); | ||
|
||
const suite = new B.Bench(); | ||
await suite | ||
.add("libp2p-logger", () => { | ||
libp2pLogger("hello"); | ||
}) | ||
.add("peerbit-logger", () => { | ||
peerbitLogger.info("hello"); | ||
}) | ||
.run(); | ||
|
||
console.table(suite.table()); |