Skip to content

Commit

Permalink
fix: Pass message to log calls as first argument (#2363)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
taratatach authored Dec 10, 2024
1 parent fa6d1dd commit 74abd19
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/sync/errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion core/sync/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 74abd19

Please sign in to comment.