From 74abd1925f5c0615125dc3c7979f79b9d46a37bd Mon Sep 17 00:00:00 2001 From: Erwan Guyader Date: Tue, 10 Dec 2024 11:21:45 +0100 Subject: [PATCH] fix: Pass message to log calls as first argument (#2363) Winston loggers expect the message to be the first argument and extra options as the other ones. Failing to do that results in messages to be interpreted as options and transformed into objects and finally not being properly displayed (or filterable) when debugging. --- core/sync/errors.js | 6 +++--- core/sync/index.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/sync/errors.js b/core/sync/errors.js index 80e324201..df0d493fd 100644 --- a/core/sync/errors.js +++ b/core/sync/errors.js @@ -155,7 +155,7 @@ const retry = async ( cause /*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */, sync /*: Sync */ ) => { - log.debug(cause, 'retrying after blocking error') + log.debug('retrying after blocking error', cause) const { err } = cause if (err.code === remoteErrors.UNREACHABLE_COZY_CODE) { @@ -195,7 +195,7 @@ const skip = async ( cause /*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */, sync /*: Sync */ ) => { - log.debug(cause, 'user skipped required action') + log.debug('user skipped required action', cause) clearInterval(sync.retryInterval) @@ -212,7 +212,7 @@ const createConflict = async ( cause /*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */, sync /*: Sync */ ) => { - log.debug(cause, 'user requested conflict creation') + log.debug('user requested conflict creation', cause) clearInterval(sync.retryInterval) diff --git a/core/sync/index.js b/core/sync/index.js index bcfed8ee9..7a2068028 100644 --- a/core/sync/index.js +++ b/core/sync/index.js @@ -1010,7 +1010,7 @@ class Sync { cause /*: {| err: RemoteError |} | {| err: SyncError, change: Change |} */ ) { - log.info(cause, 'blocking sync for error') + log.info('blocking sync for error', cause) const { err } = cause