diff --git a/src/daemon/wallet/cocod-client.ts b/src/daemon/wallet/cocod-client.ts index 837a477..e2f4f1b 100644 --- a/src/daemon/wallet/cocod-client.ts +++ b/src/daemon/wallet/cocod-client.ts @@ -170,7 +170,7 @@ export function createCocodClient( const response = await fetchImpl(`http://localhost${path}`, requestInit); const rawText = await response.text(); - logger.log( + logger.debug( `[fetchJson] ${method} ${path} status=${response.status} body=${rawText}`, ); @@ -243,7 +243,7 @@ export function createCocodClient( } if (await pingInternal()) { - logger.log(`Connected to cocod daemon on ${socketPath}`); + logger.debug(`Connected to cocod daemon on ${socketPath}`); return; } } @@ -259,7 +259,7 @@ export function createCocodClient( } if (!startPromise) { - logger.log(`Starting cocod daemon via ${executable}...`); + logger.debug(`Starting cocod daemon via ${executable}...`); startPromise = startDaemon().finally(() => { startPromise = null; }); @@ -300,7 +300,7 @@ export function createCocodClient( return normalizeBalances(output); }, async receiveCashu(token: string): Promise { - logger.log( + logger.debug( `[receiveCashu] Receiving Cashu token ${tokenFingerprint(token)}`, ); const message = await callDaemon("/receive/cashu", { @@ -314,7 +314,7 @@ export function createCocodClient( "Unexpected response from cocod while receiving Cashu token.", ); } - logger.log(`[receiveCashu] Full response.output:`, message); + logger.debug(`[receiveCashu] Full response.output:`, message); return message; }, async receiveBolt11(amount: number, mintUrl?: string): Promise { diff --git a/src/utils/logger.ts b/src/utils/logger.ts index 7de5da1..af8b9c0 100644 --- a/src/utils/logger.ts +++ b/src/utils/logger.ts @@ -51,6 +51,9 @@ export const logger = { console.log(...args); writeLog("INFO", ...args); }, + debug: (...args: unknown[]) => { + writeLog("DEBUG", ...args); + }, error: (...args: unknown[]) => { console.error(...args); writeLog("ERROR", ...args);