From d5b7d9110dd637a7f67ce9e430145314812a8df1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 26 Mar 2018 15:54:13 +0200 Subject: Fix error logging --- server/lib/activitypub/actor.ts | 8 ++++---- server/lib/activitypub/process/process-update.ts | 6 +++--- server/lib/activitypub/video-comments.ts | 2 +- server/lib/activitypub/videos.ts | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) (limited to 'server/lib/activitypub') diff --git a/server/lib/activitypub/actor.ts b/server/lib/activitypub/actor.ts index fa31e71c7..b0cf9bb17 100644 --- a/server/lib/activitypub/actor.ts +++ b/server/lib/activitypub/actor.ts @@ -30,7 +30,7 @@ function setAsyncActorKeys (actor: ActorModel) { return actor.save() }) .catch(err => { - logger.error('Cannot set public/private keys of actor %d.', actor.uuid, err) + logger.error('Cannot set public/private keys of actor %d.', actor.uuid, { err }) return actor }) } @@ -117,7 +117,7 @@ async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName: try { await actorInstance.Avatar.destroy({ transaction: t }) } catch (err) { - logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, err) + logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, { err }) } } @@ -144,7 +144,7 @@ async function fetchActorTotalItems (url: string) { const { body } = await doRequest(options) return body.totalItems ? body.totalItems : 0 } catch (err) { - logger.warn('Cannot fetch remote actor count %s.', url, err) + logger.warn('Cannot fetch remote actor count %s.', url, { err }) return 0 } } @@ -393,7 +393,7 @@ async function refreshActorIfNeeded (actor: ActorModel) { return actor }) } catch (err) { - logger.warn('Cannot refresh actor.', err) + logger.warn('Cannot refresh actor.', { err }) return actor } } diff --git a/server/lib/activitypub/process/process-update.ts b/server/lib/activitypub/process/process-update.ts index 24e5589d4..51e3cc4e3 100644 --- a/server/lib/activitypub/process/process-update.ts +++ b/server/lib/activitypub/process/process-update.ts @@ -92,7 +92,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { // Don't block on request generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon) - .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, err)) + .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, { err })) // Remove old video files const videoFileDestroyTasks: Bluebird[] = [] @@ -117,7 +117,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { } // This is just a debug because we will retry the insert - logger.debug('Cannot update the remote video.', err) + logger.debug('Cannot update the remote video.', { err }) throw err } } @@ -176,7 +176,7 @@ async function updateRemoteActor (actor: ActorModel, activity: ActivityUpdate) { } // This is just a debug because we will retry the insert - logger.debug('Cannot update the remote account.', err) + logger.debug('Cannot update the remote account.', { err }) throw err } } diff --git a/server/lib/activitypub/video-comments.ts b/server/lib/activitypub/video-comments.ts index b33ae27b1..8ab0cdba4 100644 --- a/server/lib/activitypub/video-comments.ts +++ b/server/lib/activitypub/video-comments.ts @@ -111,7 +111,7 @@ async function resolveThread (url: string, comments: VideoCommentModel[] = []) { return { video, parents: comments } } catch (err) { - logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, err) + logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, { err }) if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { throw new Error('Recursion limit reached when resolving a thread') diff --git a/server/lib/activitypub/videos.ts b/server/lib/activitypub/videos.ts index 2a6636625..ffba1570b 100644 --- a/server/lib/activitypub/videos.ts +++ b/server/lib/activitypub/videos.ts @@ -152,7 +152,7 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor: // Don't block on request generateThumbnailFromUrl(video, videoObject.icon) - .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, err)) + .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, { err })) const videoCreated = await video.save(sequelizeOptions) -- cgit v1.2.3