]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/activitypub/videos/shared/creator.ts
Refactor AP video logger tags
[github/Chocobozzz/PeerTube.git] / server / lib / activitypub / videos / shared / creator.ts
index ba3f6f77fd416d3fe6f4c09957f68d5393804e8b..767bf06952e347dc31db0e233cfafc8684c7b433 100644 (file)
@@ -1,5 +1,5 @@
 
-import { logger, loggerTagsFactory } from '@server/helpers/logger'
+import { logger, loggerTagsFactory, LoggerTagsFn } from '@server/helpers/logger'
 import { sequelizeTypescript } from '@server/initializers/database'
 import { autoBlacklistVideoIfNeeded } from '@server/lib/video-blacklist'
 import { VideoModel } from '@server/models/video/video'
@@ -9,14 +9,16 @@ import { APVideoAbstractBuilder } from './abstract-builder'
 import { getVideoAttributesFromObject } from './object-to-model-attributes'
 
 export class APVideoCreator extends APVideoAbstractBuilder {
-  protected lTags = loggerTagsFactory('ap', 'video', 'create')
+  protected lTags: LoggerTagsFn
 
   constructor (protected readonly videoObject: VideoObject) {
     super()
+
+    this.lTags = loggerTagsFactory('ap', 'video', 'create', this.videoObject.uuid, this.videoObject.id)
   }
 
   async create (waitThumbnail = false) {
-    logger.debug('Adding remote video %s.', this.videoObject.id, this.lTags(this.videoObject.uuid))
+    logger.debug('Adding remote video %s.', this.videoObject.id, this.lTags())
 
     const channelActor = await this.getOrCreateVideoChannelFromVideoObject()
     const channel = channelActor.VideoChannel
@@ -57,7 +59,7 @@ export class APVideoCreator extends APVideoAbstractBuilder {
           transaction: t
         })
 
-        logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags(videoCreated.uuid))
+        logger.info('Remote video with uuid %s inserted.', this.videoObject.uuid, this.lTags())
 
         return { autoBlacklisted, videoCreated }
       } catch (err) {