From c5e1f50cc82ef37739a1597051a0821d6c533617 Mon Sep 17 00:00:00 2001 From: "fryorcraken.eth" Date: Mon, 5 Sep 2022 21:27:22 +1000 Subject: [PATCH] refactor: remove `console.log` usage --- src/lib/waku_light_push/index.ts | 9 ++++++--- src/test_utils/nwaku.ts | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/lib/waku_light_push/index.ts b/src/lib/waku_light_push/index.ts index 101bb514f0..a5a36bcce7 100644 --- a/src/lib/waku_light_push/index.ts +++ b/src/lib/waku_light_push/index.ts @@ -1,5 +1,6 @@ import type { PeerId } from "@libp2p/interface-peer-id"; import type { Peer } from "@libp2p/interface-peer-store"; +import debug from "debug"; import all from "it-all"; import * as lp from "it-length-prefixed"; import { pipe } from "it-pipe"; @@ -14,6 +15,8 @@ import { WakuMessage } from "../waku_message"; import { PushRPC } from "./push_rpc"; +const log = debug("waku:light-push"); + export const LightPushCodec = "/vac/waku/lightpush/2.0.0-beta1"; export { PushResponse }; @@ -86,16 +89,16 @@ export class WakuLightPush { const response = PushRPC.decode(bytes).response; if (!response) { - console.log("No response in PushRPC"); + log("No response in PushRPC"); return null; } return response; } catch (err) { - console.log("Failed to decode push reply", err); + log("Failed to decode push reply", err); } } catch (err) { - console.log("Failed to send waku light push request", err); + log("Failed to send waku light push request", err); } return null; } diff --git a/src/test_utils/nwaku.ts b/src/test_utils/nwaku.ts index 4cbffc3019..7d8404f322 100644 --- a/src/test_utils/nwaku.ts +++ b/src/test_utils/nwaku.ts @@ -173,7 +173,7 @@ export class Nwaku { }); this.process.on("error", (err) => { - console.log( + dbg( `nwaku ${ this.process ? this.process.pid : this.pid } process encountered an error: ${err} at ${new Date().toLocaleTimeString()}`