From 8e0fd45e14993793c64e06682a4a05c29068d398 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 30 Jul 2018 17:02:40 +0200 Subject: Add more info logging --- server/lib/activitypub/send/send-accept.ts | 3 +++ server/lib/activitypub/send/send-announce.ts | 3 +++ server/lib/activitypub/send/send-create.ts | 11 +++++++++++ server/lib/activitypub/send/send-delete.ts | 7 +++++++ server/lib/activitypub/send/send-follow.ts | 3 +++ server/lib/activitypub/send/send-like.ts | 3 +++ server/lib/activitypub/send/send-undo.ts | 9 +++++++++ server/lib/activitypub/send/send-update.ts | 5 +++++ server/lib/activitypub/send/utils.ts | 2 ++ server/models/account/account.ts | 1 - server/models/avatar/avatar.ts | 2 ++ server/models/video/video-caption.ts | 2 +- server/models/video/video-channel.ts | 2 -- server/models/video/video.ts | 4 +--- 14 files changed, 50 insertions(+), 7 deletions(-) diff --git a/server/lib/activitypub/send/send-accept.ts b/server/lib/activitypub/send/send-accept.ts index 44644a22f..dfee1ec3e 100644 --- a/server/lib/activitypub/send/send-accept.ts +++ b/server/lib/activitypub/send/send-accept.ts @@ -4,11 +4,14 @@ import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { getActorFollowAcceptActivityPubUrl, getActorFollowActivityPubUrl } from '../url' import { unicastTo } from './utils' import { followActivityData } from './send-follow' +import { logger } from '../../../helpers/logger' async function sendAccept (actorFollow: ActorFollowModel) { const follower = actorFollow.ActorFollower const me = actorFollow.ActorFollowing + logger.info('Creating job to accept follower %s.', follower.url) + const followUrl = getActorFollowActivityPubUrl(actorFollow) const followData = followActivityData(followUrl, follower, me) diff --git a/server/lib/activitypub/send/send-announce.ts b/server/lib/activitypub/send/send-announce.ts index dfc099ff2..1ab05ca3c 100644 --- a/server/lib/activitypub/send/send-announce.ts +++ b/server/lib/activitypub/send/send-announce.ts @@ -5,6 +5,7 @@ import { VideoModel } from '../../../models/video/video' import { VideoShareModel } from '../../../models/video/video-share' import { broadcastToFollowers } from './utils' import { getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience } from '../audience' +import { logger } from '../../../helpers/logger' async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { const announcedObject = video.url @@ -17,6 +18,8 @@ async function buildVideoAnnounce (byActor: ActorModel, videoShare: VideoShareMo async function sendVideoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { const data = await buildVideoAnnounce(byActor, videoShare, video, t) + logger.info('Creating job to send announce %s.', videoShare.url) + return broadcastToFollowers(data, byActor, [ byActor ], t) } diff --git a/server/lib/activitypub/send/send-create.ts b/server/lib/activitypub/send/send-create.ts index 293947b05..f7a8cf0b3 100644 --- a/server/lib/activitypub/send/send-create.ts +++ b/server/lib/activitypub/send/send-create.ts @@ -16,10 +16,13 @@ import { getVideoAudience, getVideoCommentAudience } from '../audience' +import { logger } from '../../../helpers/logger' async function sendCreateVideo (video: VideoModel, t: Transaction) { if (video.privacy === VideoPrivacy.PRIVATE) return undefined + logger.info('Creating job to send video creation of %s.', video.url) + const byActor = video.VideoChannel.Account.Actor const videoObject = video.toActivityPubObject() @@ -32,6 +35,8 @@ async function sendCreateVideo (video: VideoModel, t: Transaction) { async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, video: VideoModel, t: Transaction) { const url = getVideoAbuseActivityPubUrl(videoAbuse) + logger.info('Creating job to send video abuse %s.', url) + const audience = { to: [ video.VideoChannel.Account.Actor.url ], cc: [] } const data = createActivityData(url, byActor, videoAbuse.toActivityPubObject(), audience) @@ -39,6 +44,8 @@ async function sendVideoAbuse (byActor: ActorModel, videoAbuse: VideoAbuseModel, } async function sendCreateVideoComment (comment: VideoCommentModel, t: Transaction) { + logger.info('Creating job to send comment %s.', comment.url) + const isOrigin = comment.Video.isOwned() const byActor = comment.Account.Actor @@ -74,6 +81,8 @@ async function sendCreateVideoComment (comment: VideoCommentModel, t: Transactio } async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to send view of %s.', video.url) + const url = getVideoViewActivityPubUrl(byActor, video) const viewActivityData = createViewActivityData(byActor, video) @@ -98,6 +107,8 @@ async function sendCreateView (byActor: ActorModel, video: VideoModel, t: Transa } async function sendCreateDislike (byActor: ActorModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to dislike %s.', video.url) + const url = getVideoDislikeActivityPubUrl(byActor, video) const dislikeActivityData = createDislikeActivityData(byActor, video) diff --git a/server/lib/activitypub/send/send-delete.ts b/server/lib/activitypub/send/send-delete.ts index e9a8951b5..3d1dfb699 100644 --- a/server/lib/activitypub/send/send-delete.ts +++ b/server/lib/activitypub/send/send-delete.ts @@ -7,8 +7,11 @@ import { VideoShareModel } from '../../../models/video/video-share' import { getDeleteActivityPubUrl } from '../url' import { broadcastToActors, broadcastToFollowers, unicastTo } from './utils' import { audiencify, getActorsInvolvedInVideo, getVideoCommentAudience } from '../audience' +import { logger } from '../../../helpers/logger' async function sendDeleteVideo (video: VideoModel, t: Transaction) { + logger.info('Creating job to broadcast delete of video %s.', video.url) + const url = getDeleteActivityPubUrl(video.url) const byActor = video.VideoChannel.Account.Actor @@ -21,6 +24,8 @@ async function sendDeleteVideo (video: VideoModel, t: Transaction) { } async function sendDeleteActor (byActor: ActorModel, t: Transaction) { + logger.info('Creating job to broadcast delete of actor %s.', byActor.url) + const url = getDeleteActivityPubUrl(byActor.url) const data = deleteActivityData(url, byActor.url, byActor) @@ -31,6 +36,8 @@ async function sendDeleteActor (byActor: ActorModel, t: Transaction) { } async function sendDeleteVideoComment (videoComment: VideoCommentModel, t: Transaction) { + logger.info('Creating job to send delete of comment %s.', videoComment.url) + const isVideoOrigin = videoComment.Video.isOwned() const url = getDeleteActivityPubUrl(videoComment.url) diff --git a/server/lib/activitypub/send/send-follow.ts b/server/lib/activitypub/send/send-follow.ts index f81d9a194..2faffe6e7 100644 --- a/server/lib/activitypub/send/send-follow.ts +++ b/server/lib/activitypub/send/send-follow.ts @@ -3,11 +3,14 @@ import { ActorModel } from '../../../models/activitypub/actor' import { ActorFollowModel } from '../../../models/activitypub/actor-follow' import { getActorFollowActivityPubUrl } from '../url' import { unicastTo } from './utils' +import { logger } from '../../../helpers/logger' function sendFollow (actorFollow: ActorFollowModel) { const me = actorFollow.ActorFollower const following = actorFollow.ActorFollowing + logger.info('Creating job to send follow request to %s.', following.url) + const url = getActorFollowActivityPubUrl(actorFollow) const data = followActivityData(url, me, following) diff --git a/server/lib/activitypub/send/send-like.ts b/server/lib/activitypub/send/send-like.ts index 37ee7c096..83225f5df 100644 --- a/server/lib/activitypub/send/send-like.ts +++ b/server/lib/activitypub/send/send-like.ts @@ -5,8 +5,11 @@ import { VideoModel } from '../../../models/video/video' import { getVideoLikeActivityPubUrl } from '../url' import { broadcastToFollowers, unicastTo } from './utils' import { audiencify, getActorsInvolvedInVideo, getAudience, getObjectFollowersAudience, getVideoAudience } from '../audience' +import { logger } from '../../../helpers/logger' async function sendLike (byActor: ActorModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to like %s.', video.url) + const url = getVideoLikeActivityPubUrl(byActor, video) const accountsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) diff --git a/server/lib/activitypub/send/send-undo.ts b/server/lib/activitypub/send/send-undo.ts index 33c3d2429..4e5dd3973 100644 --- a/server/lib/activitypub/send/send-undo.ts +++ b/server/lib/activitypub/send/send-undo.ts @@ -18,11 +18,14 @@ import { followActivityData } from './send-follow' import { likeActivityData } from './send-like' import { VideoShareModel } from '../../../models/video/video-share' import { buildVideoAnnounce } from './send-announce' +import { logger } from '../../../helpers/logger' async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) { const me = actorFollow.ActorFollower const following = actorFollow.ActorFollowing + logger.info('Creating job to send an unfollow request to %s.', following.url) + const followUrl = getActorFollowActivityPubUrl(actorFollow) const undoUrl = getUndoActivityPubUrl(followUrl) @@ -33,6 +36,8 @@ async function sendUndoFollow (actorFollow: ActorFollowModel, t: Transaction) { } async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to undo a like of video %s.', video.url) + const likeUrl = getVideoLikeActivityPubUrl(byActor, video) const undoUrl = getUndoActivityPubUrl(likeUrl) @@ -55,6 +60,8 @@ async function sendUndoLike (byActor: ActorModel, video: VideoModel, t: Transact } async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to undo a dislike of video %s.', video.url) + const dislikeUrl = getVideoDislikeActivityPubUrl(byActor, video) const undoUrl = getUndoActivityPubUrl(dislikeUrl) @@ -76,6 +83,8 @@ async function sendUndoDislike (byActor: ActorModel, video: VideoModel, t: Trans } async function sendUndoAnnounce (byActor: ActorModel, videoShare: VideoShareModel, video: VideoModel, t: Transaction) { + logger.info('Creating job to undo announce %s.', videoShare.url) + const undoUrl = getUndoActivityPubUrl(videoShare.url) const actorsInvolvedInVideo = await getActorsInvolvedInVideo(video, t) diff --git a/server/lib/activitypub/send/send-update.ts b/server/lib/activitypub/send/send-update.ts index 2fd374ec6..17d4f185c 100644 --- a/server/lib/activitypub/send/send-update.ts +++ b/server/lib/activitypub/send/send-update.ts @@ -9,8 +9,11 @@ import { VideoShareModel } from '../../../models/video/video-share' import { getUpdateActivityPubUrl } from '../url' import { broadcastToFollowers } from './utils' import { audiencify, getAudience } from '../audience' +import { logger } from '../../../helpers/logger' async function sendUpdateVideo (video: VideoModel, t: Transaction) { + logger.info('Creating job to update video %s.', video.url) + const byActor = video.VideoChannel.Account.Actor const url = getUpdateActivityPubUrl(video.url, video.updatedAt.toISOString()) @@ -28,6 +31,8 @@ async function sendUpdateVideo (video: VideoModel, t: Transaction) { async function sendUpdateActor (accountOrChannel: AccountModel | VideoChannelModel, t: Transaction) { const byActor = accountOrChannel.Actor + logger.info('Creating job to update actor %s.', byActor.url) + const url = getUpdateActivityPubUrl(byActor.url, byActor.updatedAt.toISOString()) const accountOrChannelObject = accountOrChannel.toActivityPubObject() const audience = getAudience(byActor) diff --git a/server/lib/activitypub/send/utils.ts b/server/lib/activitypub/send/utils.ts index 241db6c8c..0d28444ec 100644 --- a/server/lib/activitypub/send/utils.ts +++ b/server/lib/activitypub/send/utils.ts @@ -26,6 +26,8 @@ async function forwardActivity ( followersException: ActorModel[] = [], additionalFollowerUrls: string[] = [] ) { + logger.info('Forwarding activity %s.', activity.id) + const to = activity.to || [] const cc = activity.cc || [] diff --git a/server/models/account/account.ts b/server/models/account/account.ts index 2eed66fc2..d674d8d22 100644 --- a/server/models/account/account.ts +++ b/server/models/account/account.ts @@ -139,7 +139,6 @@ export class AccountModel extends Model { } if (instance.isOwned()) { - logger.debug('Sending delete of actor of account %s.', instance.Actor.url) return sendDeleteActor(instance.Actor, options.transaction) } diff --git a/server/models/avatar/avatar.ts b/server/models/avatar/avatar.ts index e1d4c20bc..51e26c87b 100644 --- a/server/models/avatar/avatar.ts +++ b/server/models/avatar/avatar.ts @@ -3,6 +3,7 @@ import { AfterDestroy, AllowNull, Column, CreatedAt, Model, Table, UpdatedAt } f import { Avatar } from '../../../shared/models/avatars/avatar.model' import { unlinkPromise } from '../../helpers/core-utils' import { CONFIG, STATIC_PATHS } from '../../initializers' +import { logger } from '../../helpers/logger' @Table({ tableName: 'avatar' @@ -21,6 +22,7 @@ export class AvatarModel extends Model { @AfterDestroy static removeFilesAndSendDelete (instance: AvatarModel) { + logger.info('Removing avatar file %s.', instance.filename) return instance.removeAvatar() } diff --git a/server/models/video/video-caption.ts b/server/models/video/video-caption.ts index 5a1becc47..4a25097f8 100644 --- a/server/models/video/video-caption.ts +++ b/server/models/video/video-caption.ts @@ -80,7 +80,7 @@ export class VideoCaptionModel extends Model { } if (instance.isOwned()) { - logger.debug('Removing captions %s of video %s.', instance.Video.uuid, instance.language) + logger.info('Removing captions %s of video %s.', instance.Video.uuid, instance.language) try { await instance.removeCaptionFile() diff --git a/server/models/video/video-channel.ts b/server/models/video/video-channel.ts index 6567b00d6..d0dba18d5 100644 --- a/server/models/video/video-channel.ts +++ b/server/models/video/video-channel.ts @@ -140,8 +140,6 @@ export class VideoChannelModel extends Model { } if (instance.Actor.isOwned()) { - logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url) - return sendDeleteActor(instance.Actor, options.transaction) } diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 5808f3936..a6c4620b2 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -607,8 +607,6 @@ export class VideoModel extends Model { }) as VideoChannelModel } - logger.debug('Sending delete of video %s.', instance.url) - return sendDeleteVideo(instance, options.transaction) } @@ -619,7 +617,7 @@ export class VideoModel extends Model { static async removeFiles (instance: VideoModel) { const tasks: Promise[] = [] - logger.debug('Removing files of video %s.', instance.url) + logger.info('Removing files of video %s.', instance.url) tasks.push(instance.removeThumbnail()) -- cgit v1.2.3