From 452b3bea082481b84537e55c7cedc1e24860d543 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 5 Mar 2021 13:26:02 +0100 Subject: Introduce tags to the logger That could help to filter unneeded logs and/or select particular components --- server/lib/activitypub/share.ts | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'server/lib/activitypub/share.ts') diff --git a/server/lib/activitypub/share.ts b/server/lib/activitypub/share.ts index 1f8a8f3c4..dde0c628e 100644 --- a/server/lib/activitypub/share.ts +++ b/server/lib/activitypub/share.ts @@ -1,15 +1,17 @@ -import { Transaction } from 'sequelize' -import { VideoShareModel } from '../../models/video/video-share' -import { sendUndoAnnounce, sendVideoAnnounce } from './send' -import { getLocalVideoAnnounceActivityPubUrl } from './url' import * as Bluebird from 'bluebird' +import { Transaction } from 'sequelize' +import { getServerActor } from '@server/models/application/application' +import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' +import { logger, loggerTagsFactory } from '../../helpers/logger' import { doRequest } from '../../helpers/requests' -import { getOrCreateActorAndServerAndModel } from './actor' -import { logger } from '../../helpers/logger' import { CRAWL_REQUEST_CONCURRENCY } from '../../initializers/constants' -import { checkUrlsSameHost, getAPId } from '../../helpers/activitypub' +import { VideoShareModel } from '../../models/video/video-share' import { MChannelActorLight, MVideo, MVideoAccountLight, MVideoId } from '../../types/models/video' -import { getServerActor } from '@server/models/application/application' +import { getOrCreateActorAndServerAndModel } from './actor' +import { sendUndoAnnounce, sendVideoAnnounce } from './send' +import { getLocalVideoAnnounceActivityPubUrl } from './url' + +const lTags = loggerTagsFactory('share') async function shareVideoByServerAndChannel (video: MVideoAccountLight, t: Transaction) { if (!video.hasPrivacyForFederation()) return undefined @@ -25,7 +27,10 @@ async function changeVideoChannelShare ( oldVideoChannel: MChannelActorLight, t: Transaction ) { - logger.info('Updating video channel of video %s: %s -> %s.', video.uuid, oldVideoChannel.name, video.VideoChannel.name) + logger.info( + 'Updating video channel of video %s: %s -> %s.', video.uuid, oldVideoChannel.name, video.VideoChannel.name, + lTags(video.uuid) + ) await undoShareByVideoChannel(video, oldVideoChannel, t) -- cgit v1.2.3