]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Add more info logging
authorChocobozzz <me@florianbigard.com>
Mon, 30 Jul 2018 15:02:40 +0000 (17:02 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 30 Jul 2018 15:02:40 +0000 (17:02 +0200)
14 files changed:
server/lib/activitypub/send/send-accept.ts
server/lib/activitypub/send/send-announce.ts
server/lib/activitypub/send/send-create.ts
server/lib/activitypub/send/send-delete.ts
server/lib/activitypub/send/send-follow.ts
server/lib/activitypub/send/send-like.ts
server/lib/activitypub/send/send-undo.ts
server/lib/activitypub/send/send-update.ts
server/lib/activitypub/send/utils.ts
server/models/account/account.ts
server/models/avatar/avatar.ts
server/models/video/video-caption.ts
server/models/video/video-channel.ts
server/models/video/video.ts

index 44644a22f3d57189e9c35b36c9cb750f345c2006..dfee1ec3e9bf255d95f56740cca996623590bd0e 100644 (file)
@@ -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)
 
index dfc099ff26948201d778ec7dbfb3a82a0f1bbba0..1ab05ca3ccc2751e1c37af4aa8747e4373ab7db1 100644 (file)
@@ -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)
 }
 
index 293947b052898d446373a1eb37eed10e49f56c05..f7a8cf0b36da47160e8ca7b95149bd41f4fc6808 100644 (file)
@@ -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)
 
index e9a8951b5911f214fc90a4263ccbc4a7ca998ed4..3d1dfb699e287965bbbf974741be4ef2a34f5a41 100644 (file)
@@ -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)
index f81d9a1942ed2c57ccef3d84103a03407bad8982..2faffe6e703d5332b200daf5cffe8cff40d373b9 100644 (file)
@@ -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)
 
index 37ee7c09669951506d0f1c5c883fe3c731db4ca6..83225f5df1d62186561e40a43953815d35773c13 100644 (file)
@@ -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)
index 33c3d24291cbf7550f2e108d00c1695650584dd6..4e5dd39737e39c5d07eaca92b968b79743935e4a 100644 (file)
@@ -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)
index 2fd374ec65312fd068f9fded3abdab243a34f07f..17d4f185c9464ad973ab9416053222e60ff1883f 100644 (file)
@@ -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)
index 241db6c8cfc603f4eca27c6b5d6ebbc6508d59f9..0d28444ec499f856f60c8aa0fedbbd64a4b68db1 100644 (file)
@@ -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 || []
 
index 2eed66fc2696641fbcbf785581adc7d64270c28a..d674d8d22de3402f5a230a0289324bbd3c8739c9 100644 (file)
@@ -139,7 +139,6 @@ export class AccountModel extends Model<AccountModel> {
     }
 
     if (instance.isOwned()) {
-      logger.debug('Sending delete of actor of account %s.', instance.Actor.url)
       return sendDeleteActor(instance.Actor, options.transaction)
     }
 
index e1d4c20bccd1dd554200ad0c0e1a674e213cb0ac..51e26c87b3a597bcd8b35c91a7273affd1ce7f15 100644 (file)
@@ -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<AvatarModel> {
 
   @AfterDestroy
   static removeFilesAndSendDelete (instance: AvatarModel) {
+    logger.info('Removing avatar file %s.', instance.filename)
     return instance.removeAvatar()
   }
 
index 5a1becc47936c8169e8f91737448bcdc1ab9f004..4a25097f8a6c5a1c152c8d66b4940f7d1f13f7d6 100644 (file)
@@ -80,7 +80,7 @@ export class VideoCaptionModel extends Model<VideoCaptionModel> {
     }
 
     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()
index 6567b00d69475bc9037218442740eff6a1f2345c..d0dba18d5ac16c034b500d96c1a265286b2c0867 100644 (file)
@@ -140,8 +140,6 @@ export class VideoChannelModel extends Model<VideoChannelModel> {
     }
 
     if (instance.Actor.isOwned()) {
-      logger.debug('Sending delete of actor of video channel %s.', instance.Actor.url)
-
       return sendDeleteActor(instance.Actor, options.transaction)
     }
 
index 5808f3936d712084519c6a37730f91478219f2ad..a6c4620b2367a8a90979827071b3a40bf37df05c 100644 (file)
@@ -607,8 +607,6 @@ export class VideoModel extends Model<VideoModel> {
         }) 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<VideoModel> {
   static async removeFiles (instance: VideoModel) {
     const tasks: Promise<any>[] = []
 
-    logger.debug('Removing files of video %s.', instance.url)
+    logger.info('Removing files of video %s.', instance.url)
 
     tasks.push(instance.removeThumbnail())