diff options
24 files changed, 57 insertions, 41 deletions
@@ -27,13 +27,21 @@ const app = express() | |||
27 | // ----------- Core checker ----------- | 27 | // ----------- Core checker ----------- |
28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' | 28 | import { checkMissedConfig, checkFFmpeg, checkConfig } from './server/initializers/checker' |
29 | 29 | ||
30 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
31 | import { logger } from './server/helpers/logger' | ||
32 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
33 | |||
30 | const missed = checkMissedConfig() | 34 | const missed = checkMissedConfig() |
31 | if (missed.length !== 0) { | 35 | if (missed.length !== 0) { |
32 | throw new Error('Your configuration files miss keys: ' + missed) | 36 | logger.error('Your configuration files miss keys: ' + missed) |
37 | process.exit(-1) | ||
33 | } | 38 | } |
34 | 39 | ||
35 | import { ACCEPT_HEADERS, API_VERSION, CONFIG, STATIC_PATHS } from './server/initializers/constants' | ||
36 | checkFFmpeg(CONFIG) | 40 | checkFFmpeg(CONFIG) |
41 | .catch(err => { | ||
42 | logger.error('Error in ffmpeg check.', { err }) | ||
43 | process.exit(-1) | ||
44 | }) | ||
37 | 45 | ||
38 | const errorMessage = checkConfig() | 46 | const errorMessage = checkConfig() |
39 | if (errorMessage !== null) { | 47 | if (errorMessage !== null) { |
@@ -41,8 +49,6 @@ if (errorMessage !== null) { | |||
41 | } | 49 | } |
42 | 50 | ||
43 | // ----------- Database ----------- | 51 | // ----------- Database ----------- |
44 | // Do not use barrels because we don't want to load all modules here (we need to initialize database first) | ||
45 | import { logger } from './server/helpers/logger' | ||
46 | 52 | ||
47 | // Initialize database and models | 53 | // Initialize database and models |
48 | import { initDatabaseModels } from './server/initializers/database' | 54 | import { initDatabaseModels } from './server/initializers/database' |
diff --git a/server/controllers/api/server/follows.ts b/server/controllers/api/server/follows.ts index 4a0a44cd3..bb0063473 100644 --- a/server/controllers/api/server/follows.ts +++ b/server/controllers/api/server/follows.ts | |||
@@ -93,14 +93,14 @@ async function followRetry (req: express.Request, res: express.Response, next: e | |||
93 | 93 | ||
94 | return retryTransactionWrapper(follow, options) | 94 | return retryTransactionWrapper(follow, options) |
95 | }) | 95 | }) |
96 | .catch(err => logger.warn('Cannot follow server %s.', sanitizedHost, err)) | 96 | .catch(err => logger.warn('Cannot follow server %s.', sanitizedHost, { err })) |
97 | 97 | ||
98 | tasks.push(p) | 98 | tasks.push(p) |
99 | } | 99 | } |
100 | 100 | ||
101 | // Don't make the client wait the tasks | 101 | // Don't make the client wait the tasks |
102 | Promise.all(tasks) | 102 | Promise.all(tasks) |
103 | .catch(err => logger.error('Error in follow.', err)) | 103 | .catch(err => logger.error('Error in follow.', { err })) |
104 | 104 | ||
105 | return res.status(204).end() | 105 | return res.status(204).end() |
106 | } | 106 | } |
@@ -144,7 +144,7 @@ async function removeFollow (req: express.Request, res: express.Response, next: | |||
144 | // This could be long so don't wait this task | 144 | // This could be long so don't wait this task |
145 | const following = follow.ActorFollowing | 145 | const following = follow.ActorFollowing |
146 | following.destroy() | 146 | following.destroy() |
147 | .catch(err => logger.error('Cannot destroy actor that we do not follow anymore %s.', following.url, err)) | 147 | .catch(err => logger.error('Cannot destroy actor that we do not follow anymore %s.', following.url, { err })) |
148 | 148 | ||
149 | return res.status(204).end() | 149 | return res.status(204).end() |
150 | } | 150 | } |
diff --git a/server/controllers/api/videos/blacklist.ts b/server/controllers/api/videos/blacklist.ts index 7eee460d4..8112b59b8 100644 --- a/server/controllers/api/videos/blacklist.ts +++ b/server/controllers/api/videos/blacklist.ts | |||
@@ -69,7 +69,7 @@ async function removeVideoFromBlacklistController (req: express.Request, res: ex | |||
69 | 69 | ||
70 | return res.sendStatus(204) | 70 | return res.sendStatus(204) |
71 | } catch (err) { | 71 | } catch (err) { |
72 | logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, err) | 72 | logger.error('Some error while removing video %s from blacklist.', res.locals.video.uuid, { err }) |
73 | throw err | 73 | throw err |
74 | } | 74 | } |
75 | } | 75 | } |
diff --git a/server/controllers/api/videos/channel.ts b/server/controllers/api/videos/channel.ts index fba5681de..e547d375f 100644 --- a/server/controllers/api/videos/channel.ts +++ b/server/controllers/api/videos/channel.ts | |||
@@ -98,7 +98,7 @@ async function addVideoChannel (req: express.Request, res: express.Response) { | |||
98 | }) | 98 | }) |
99 | 99 | ||
100 | setAsyncActorKeys(videoChannelCreated.Actor) | 100 | setAsyncActorKeys(videoChannelCreated.Actor) |
101 | .catch(err => logger.error('Cannot set async actor keys for account %s.', videoChannelCreated.Actor.uuid, err)) | 101 | .catch(err => logger.error('Cannot set async actor keys for account %s.', videoChannelCreated.Actor.uuid, { err })) |
102 | 102 | ||
103 | logger.info('Video channel with uuid %s created.', videoChannelCreated.Actor.uuid) | 103 | logger.info('Video channel with uuid %s created.', videoChannelCreated.Actor.uuid) |
104 | 104 | ||
@@ -137,7 +137,7 @@ async function updateVideoChannel (req: express.Request, res: express.Response) | |||
137 | 137 | ||
138 | logger.info('Video channel with name %s and uuid %s updated.', videoChannelInstance.name, videoChannelInstance.Actor.uuid) | 138 | logger.info('Video channel with name %s and uuid %s updated.', videoChannelInstance.name, videoChannelInstance.Actor.uuid) |
139 | } catch (err) { | 139 | } catch (err) { |
140 | logger.debug('Cannot update the video channel.', err) | 140 | logger.debug('Cannot update the video channel.', { err }) |
141 | 141 | ||
142 | // Force fields we want to update | 142 | // Force fields we want to update |
143 | // If the transaction is retried, sequelize will think the object has not changed | 143 | // If the transaction is retried, sequelize will think the object has not changed |
diff --git a/server/helpers/database-utils.ts b/server/helpers/database-utils.ts index d09b4b245..47a0abfd2 100644 --- a/server/helpers/database-utils.ts +++ b/server/helpers/database-utils.ts | |||
@@ -16,7 +16,7 @@ function retryTransactionWrapper <T> ( | |||
16 | .catch(err => callback(err)) | 16 | .catch(err => callback(err)) |
17 | }) | 17 | }) |
18 | .catch(err => { | 18 | .catch(err => { |
19 | logger.error(options.errorMessage, err) | 19 | logger.error(options.errorMessage, { err }) |
20 | throw err | 20 | throw err |
21 | }) | 21 | }) |
22 | } | 22 | } |
diff --git a/server/helpers/ffmpeg-utils.ts b/server/helpers/ffmpeg-utils.ts index 8f9a03c26..bfc942fa3 100644 --- a/server/helpers/ffmpeg-utils.ts +++ b/server/helpers/ffmpeg-utils.ts | |||
@@ -64,12 +64,12 @@ async function generateImageFromVideoFile (fromPath: string, folder: string, ima | |||
64 | const destination = join(folder, imageName) | 64 | const destination = join(folder, imageName) |
65 | await processImage({ path: pendingImagePath }, destination, size) | 65 | await processImage({ path: pendingImagePath }, destination, size) |
66 | } catch (err) { | 66 | } catch (err) { |
67 | logger.error('Cannot generate image from video %s.', fromPath, err) | 67 | logger.error('Cannot generate image from video %s.', fromPath, { err }) |
68 | 68 | ||
69 | try { | 69 | try { |
70 | await unlinkPromise(pendingImagePath) | 70 | await unlinkPromise(pendingImagePath) |
71 | } catch (err) { | 71 | } catch (err) { |
72 | logger.debug('Cannot remove pending image path after generation error.', err) | 72 | logger.debug('Cannot remove pending image path after generation error.', { err }) |
73 | } | 73 | } |
74 | } | 74 | } |
75 | } | 75 | } |
diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index 7968b5ec9..d92381a2c 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts | |||
@@ -18,7 +18,11 @@ const excludedKeys = { | |||
18 | label: true | 18 | label: true |
19 | } | 19 | } |
20 | function keysExcluder (key, value) { | 20 | function keysExcluder (key, value) { |
21 | return excludedKeys[key] === true ? undefined : value | 21 | if (excludedKeys[key] === true) return undefined |
22 | |||
23 | if (key === 'err') return value.stack | ||
24 | |||
25 | return value | ||
22 | } | 26 | } |
23 | 27 | ||
24 | const consoleLoggerFormat = winston.format.printf(info => { | 28 | const consoleLoggerFormat = winston.format.printf(info => { |
@@ -30,8 +34,14 @@ const consoleLoggerFormat = winston.format.printf(info => { | |||
30 | return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` | 34 | return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` |
31 | }) | 35 | }) |
32 | 36 | ||
33 | const jsonLoggerFormat = winston.format.printf(info => { | 37 | const jsonLoggerFormat = winston.format.printf(infoArg => { |
34 | if (info.message && info.message.stack !== undefined) info.message = info.message.stack | 38 | let info = infoArg.err |
39 | ? Object.assign({}, infoArg, { err: infoArg.err.stack }) | ||
40 | : infoArg | ||
41 | |||
42 | if (infoArg.message && infoArg.message.stack !== undefined) { | ||
43 | info = Object.assign({}, info, { message: infoArg.message.stack }) | ||
44 | } | ||
35 | 45 | ||
36 | return JSON.stringify(info) | 46 | return JSON.stringify(info) |
37 | }) | 47 | }) |
diff --git a/server/helpers/peertube-crypto.ts b/server/helpers/peertube-crypto.ts index 313c12e26..5c182961d 100644 --- a/server/helpers/peertube-crypto.ts +++ b/server/helpers/peertube-crypto.ts | |||
@@ -35,7 +35,7 @@ function isSignatureVerified (fromActor: ActorModel, signedDocument: object) { | |||
35 | 35 | ||
36 | return jsig.promises.verify(signedDocument, options) | 36 | return jsig.promises.verify(signedDocument, options) |
37 | .catch(err => { | 37 | .catch(err => { |
38 | logger.error('Cannot check signature.', err) | 38 | logger.error('Cannot check signature.', { err }) |
39 | return false | 39 | return false |
40 | }) | 40 | }) |
41 | } | 41 | } |
diff --git a/server/helpers/utils.ts b/server/helpers/utils.ts index 3b618360b..c58117219 100644 --- a/server/helpers/utils.ts +++ b/server/helpers/utils.ts | |||
@@ -44,7 +44,7 @@ function createReqFiles ( | |||
44 | try { | 44 | try { |
45 | randomString = await generateRandomString(16) | 45 | randomString = await generateRandomString(16) |
46 | } catch (err) { | 46 | } catch (err) { |
47 | logger.error('Cannot generate random string for file name.', err) | 47 | logger.error('Cannot generate random string for file name.', { err }) |
48 | randomString = 'fake-random-string' | 48 | randomString = 'fake-random-string' |
49 | } | 49 | } |
50 | 50 | ||
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 324a2c2e5..d2f6c7c8c 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -19,7 +19,7 @@ async function installApplication () { | |||
19 | await createOAuthClientIfNotExist() | 19 | await createOAuthClientIfNotExist() |
20 | await createOAuthAdminIfNotExist() | 20 | await createOAuthAdminIfNotExist() |
21 | } catch (err) { | 21 | } catch (err) { |
22 | logger.error('Cannot install application.', err) | 22 | logger.error('Cannot install application.', { err }) |
23 | process.exit(-1) | 23 | process.exit(-1) |
24 | } | 24 | } |
25 | } | 25 | } |
diff --git a/server/initializers/migrator.ts b/server/initializers/migrator.ts index c767acc83..466369729 100644 --- a/server/initializers/migrator.ts +++ b/server/initializers/migrator.ts | |||
@@ -35,7 +35,7 @@ async function migrate () { | |||
35 | try { | 35 | try { |
36 | await executeMigration(actualVersion, migrationScript) | 36 | await executeMigration(actualVersion, migrationScript) |
37 | } catch (err) { | 37 | } catch (err) { |
38 | logger.error('Cannot execute migration %s.', migrationScript.version, err) | 38 | logger.error('Cannot execute migration %s.', migrationScript.version, { err }) |
39 | process.exit(-1) | 39 | process.exit(-1) |
40 | } | 40 | } |
41 | } | 41 | } |
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) { | |||
30 | return actor.save() | 30 | return actor.save() |
31 | }) | 31 | }) |
32 | .catch(err => { | 32 | .catch(err => { |
33 | logger.error('Cannot set public/private keys of actor %d.', actor.uuid, err) | 33 | logger.error('Cannot set public/private keys of actor %d.', actor.uuid, { err }) |
34 | return actor | 34 | return actor |
35 | }) | 35 | }) |
36 | } | 36 | } |
@@ -117,7 +117,7 @@ async function updateActorAvatarInstance (actorInstance: ActorModel, avatarName: | |||
117 | try { | 117 | try { |
118 | await actorInstance.Avatar.destroy({ transaction: t }) | 118 | await actorInstance.Avatar.destroy({ transaction: t }) |
119 | } catch (err) { | 119 | } catch (err) { |
120 | logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, err) | 120 | logger.error('Cannot remove old avatar of actor %s.', actorInstance.url, { err }) |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
@@ -144,7 +144,7 @@ async function fetchActorTotalItems (url: string) { | |||
144 | const { body } = await doRequest(options) | 144 | const { body } = await doRequest(options) |
145 | return body.totalItems ? body.totalItems : 0 | 145 | return body.totalItems ? body.totalItems : 0 |
146 | } catch (err) { | 146 | } catch (err) { |
147 | logger.warn('Cannot fetch remote actor count %s.', url, err) | 147 | logger.warn('Cannot fetch remote actor count %s.', url, { err }) |
148 | return 0 | 148 | return 0 |
149 | } | 149 | } |
150 | } | 150 | } |
@@ -393,7 +393,7 @@ async function refreshActorIfNeeded (actor: ActorModel) { | |||
393 | return actor | 393 | return actor |
394 | }) | 394 | }) |
395 | } catch (err) { | 395 | } catch (err) { |
396 | logger.warn('Cannot refresh actor.', err) | 396 | logger.warn('Cannot refresh actor.', { err }) |
397 | return actor | 397 | return actor |
398 | } | 398 | } |
399 | } | 399 | } |
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) { | |||
92 | 92 | ||
93 | // Don't block on request | 93 | // Don't block on request |
94 | generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon) | 94 | generateThumbnailFromUrl(videoInstance, videoAttributesToUpdate.icon) |
95 | .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, err)) | 95 | .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoAttributesToUpdate.id, { err })) |
96 | 96 | ||
97 | // Remove old video files | 97 | // Remove old video files |
98 | const videoFileDestroyTasks: Bluebird<void>[] = [] | 98 | const videoFileDestroyTasks: Bluebird<void>[] = [] |
@@ -117,7 +117,7 @@ async function updateRemoteVideo (actor: ActorModel, activity: ActivityUpdate) { | |||
117 | } | 117 | } |
118 | 118 | ||
119 | // This is just a debug because we will retry the insert | 119 | // This is just a debug because we will retry the insert |
120 | logger.debug('Cannot update the remote video.', err) | 120 | logger.debug('Cannot update the remote video.', { err }) |
121 | throw err | 121 | throw err |
122 | } | 122 | } |
123 | } | 123 | } |
@@ -176,7 +176,7 @@ async function updateRemoteActor (actor: ActorModel, activity: ActivityUpdate) { | |||
176 | } | 176 | } |
177 | 177 | ||
178 | // This is just a debug because we will retry the insert | 178 | // This is just a debug because we will retry the insert |
179 | logger.debug('Cannot update the remote account.', err) | 179 | logger.debug('Cannot update the remote account.', { err }) |
180 | throw err | 180 | throw err |
181 | } | 181 | } |
182 | } | 182 | } |
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[] = []) { | |||
111 | 111 | ||
112 | return { video, parents: comments } | 112 | return { video, parents: comments } |
113 | } catch (err) { | 113 | } catch (err) { |
114 | logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, err) | 114 | logger.debug('Cannot get or create account and video and channel for reply %s, fetch comment', url, { err }) |
115 | 115 | ||
116 | if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { | 116 | if (comments.length > ACTIVITY_PUB.MAX_RECURSION_COMMENTS) { |
117 | throw new Error('Recursion limit reached when resolving a thread') | 117 | 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: | |||
152 | 152 | ||
153 | // Don't block on request | 153 | // Don't block on request |
154 | generateThumbnailFromUrl(video, videoObject.icon) | 154 | generateThumbnailFromUrl(video, videoObject.icon) |
155 | .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, err)) | 155 | .catch(err => logger.warn('Cannot generate thumbnail of %s.', videoObject.id, { err })) |
156 | 156 | ||
157 | const videoCreated = await video.save(sequelizeOptions) | 157 | const videoCreated = await video.save(sequelizeOptions) |
158 | 158 | ||
diff --git a/server/lib/emailer.ts b/server/lib/emailer.ts index f34d141ea..85cc725fa 100644 --- a/server/lib/emailer.ts +++ b/server/lib/emailer.ts | |||
@@ -119,7 +119,7 @@ class Emailer { | |||
119 | } | 119 | } |
120 | 120 | ||
121 | private dieOnConnectionFailure (err?: Error) { | 121 | private dieOnConnectionFailure (err?: Error) { |
122 | logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, err) | 122 | logger.error('Failed to connect to SMTP %s:%d.', CONFIG.SMTP.HOSTNAME, CONFIG.SMTP.PORT, { err }) |
123 | process.exit(-1) | 123 | process.exit(-1) |
124 | } | 124 | } |
125 | 125 | ||
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 66cced59a..1dc28755e 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts | |||
@@ -53,7 +53,7 @@ class JobQueue { | |||
53 | this.jobQueue.setMaxListeners(15) | 53 | this.jobQueue.setMaxListeners(15) |
54 | 54 | ||
55 | this.jobQueue.on('error', err => { | 55 | this.jobQueue.on('error', err => { |
56 | logger.error('Error in job queue.', err) | 56 | logger.error('Error in job queue.', { err }) |
57 | process.exit(-1) | 57 | process.exit(-1) |
58 | }) | 58 | }) |
59 | this.jobQueue.watchStuckJobs(5000) | 59 | this.jobQueue.watchStuckJobs(5000) |
@@ -111,7 +111,7 @@ class JobQueue { | |||
111 | const now = new Date().getTime() | 111 | const now = new Date().getTime() |
112 | kue.Job.rangeByState('complete', 0, -1, 'asc', (err, jobs) => { | 112 | kue.Job.rangeByState('complete', 0, -1, 'asc', (err, jobs) => { |
113 | if (err) { | 113 | if (err) { |
114 | logger.error('Cannot get jobs when removing old jobs.', err) | 114 | logger.error('Cannot get jobs when removing old jobs.', { err }) |
115 | return | 115 | return |
116 | } | 116 | } |
117 | 117 | ||
diff --git a/server/lib/redis.ts b/server/lib/redis.ts index 1fd366401..41f4c9869 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts | |||
@@ -23,7 +23,7 @@ class Redis { | |||
23 | }) | 23 | }) |
24 | 24 | ||
25 | this.client.on('error', err => { | 25 | this.client.on('error', err => { |
26 | logger.error('Error in Redis client.', err) | 26 | logger.error('Error in Redis client.', { err }) |
27 | process.exit(-1) | 27 | process.exit(-1) |
28 | }) | 28 | }) |
29 | 29 | ||
diff --git a/server/lib/schedulers/bad-actor-follow-scheduler.ts b/server/lib/schedulers/bad-actor-follow-scheduler.ts index 9b9f9e17d..121f7145e 100644 --- a/server/lib/schedulers/bad-actor-follow-scheduler.ts +++ b/server/lib/schedulers/bad-actor-follow-scheduler.ts | |||
@@ -17,7 +17,7 @@ export class BadActorFollowScheduler extends AbstractScheduler { | |||
17 | try { | 17 | try { |
18 | await ActorFollowModel.removeBadActorFollows() | 18 | await ActorFollowModel.removeBadActorFollows() |
19 | } catch (err) { | 19 | } catch (err) { |
20 | logger.error('Error in bad actor follows scheduler.', err) | 20 | logger.error('Error in bad actor follows scheduler.', { err }) |
21 | } | 21 | } |
22 | } | 22 | } |
23 | 23 | ||
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts index 1488b42ab..12d5c22c5 100644 --- a/server/middlewares/activitypub.ts +++ b/server/middlewares/activitypub.ts | |||
@@ -18,7 +18,7 @@ async function checkSignature (req: Request, res: Response, next: NextFunction) | |||
18 | try { | 18 | try { |
19 | actor = await getOrCreateActorAndServerAndModel(creator) | 19 | actor = await getOrCreateActorAndServerAndModel(creator) |
20 | } catch (err) { | 20 | } catch (err) { |
21 | logger.error('Cannot create remote actor and check signature.', err) | 21 | logger.error('Cannot create remote actor and check signature.', { err }) |
22 | return res.sendStatus(403) | 22 | return res.sendStatus(403) |
23 | } | 23 | } |
24 | 24 | ||
diff --git a/server/middlewares/validators/videos.ts b/server/middlewares/validators/videos.ts index 1dc8429c8..e3543ef93 100644 --- a/server/middlewares/validators/videos.ts +++ b/server/middlewares/validators/videos.ts | |||
@@ -86,7 +86,7 @@ const videosAddValidator = [ | |||
86 | try { | 86 | try { |
87 | duration = await getDurationFromVideoFile(videoFile.path) | 87 | duration = await getDurationFromVideoFile(videoFile.path) |
88 | } catch (err) { | 88 | } catch (err) { |
89 | logger.error('Invalid input file in videosAddValidator.', err) | 89 | logger.error('Invalid input file in videosAddValidator.', { err }) |
90 | res.status(400) | 90 | res.status(400) |
91 | .json({ error: 'Invalid input file.' }) | 91 | .json({ error: 'Invalid input file.' }) |
92 | .end() | 92 | .end() |
diff --git a/server/models/activitypub/actor-follow.ts b/server/models/activitypub/actor-follow.ts index d3c438626..c97f4cead 100644 --- a/server/models/activitypub/actor-follow.ts +++ b/server/models/activitypub/actor-follow.ts | |||
@@ -118,12 +118,12 @@ export class ActorFollowModel extends Model<ActorFollowModel> { | |||
118 | 118 | ||
119 | if (goodInboxes.length !== 0) { | 119 | if (goodInboxes.length !== 0) { |
120 | ActorFollowModel.incrementScores(goodInboxes, ACTOR_FOLLOW_SCORE.BONUS, t) | 120 | ActorFollowModel.incrementScores(goodInboxes, ACTOR_FOLLOW_SCORE.BONUS, t) |
121 | .catch(err => logger.error('Cannot increment scores of good actor follows.', err)) | 121 | .catch(err => logger.error('Cannot increment scores of good actor follows.', { err })) |
122 | } | 122 | } |
123 | 123 | ||
124 | if (badInboxes.length !== 0) { | 124 | if (badInboxes.length !== 0) { |
125 | ActorFollowModel.incrementScores(badInboxes, ACTOR_FOLLOW_SCORE.PENALTY, t) | 125 | ActorFollowModel.incrementScores(badInboxes, ACTOR_FOLLOW_SCORE.PENALTY, t) |
126 | .catch(err => logger.error('Cannot decrement scores of bad actor follows.', err)) | 126 | .catch(err => logger.error('Cannot decrement scores of bad actor follows.', { err })) |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
diff --git a/server/models/oauth/oauth-token.ts b/server/models/oauth/oauth-token.ts index 528bb9587..759aa2779 100644 --- a/server/models/oauth/oauth-token.ts +++ b/server/models/oauth/oauth-token.ts | |||
@@ -125,7 +125,7 @@ export class OAuthTokenModel extends Model<OAuthTokenModel> { | |||
125 | } as OAuthTokenInfo | 125 | } as OAuthTokenInfo |
126 | }) | 126 | }) |
127 | .catch(err => { | 127 | .catch(err => { |
128 | logger.info('getRefreshToken error.', err) | 128 | logger.info('getRefreshToken error.', { err }) |
129 | throw err | 129 | throw err |
130 | }) | 130 | }) |
131 | } | 131 | } |
diff --git a/server/models/video/video.ts b/server/models/video/video.ts index f43b73e49..13bf0b6a2 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts | |||
@@ -473,7 +473,7 @@ export class VideoModel extends Model<VideoModel> { | |||
473 | 473 | ||
474 | return Promise.all(tasks) | 474 | return Promise.all(tasks) |
475 | .catch(err => { | 475 | .catch(err => { |
476 | logger.error('Some errors when removing files of video %s in after destroy hook.', instance.uuid, err) | 476 | logger.error('Some errors when removing files of video %s in after destroy hook.', instance.uuid, { err }) |
477 | }) | 477 | }) |
478 | } | 478 | } |
479 | 479 | ||
@@ -1213,7 +1213,7 @@ export class VideoModel extends Model<VideoModel> { | |||
1213 | 1213 | ||
1214 | } catch (err) { | 1214 | } catch (err) { |
1215 | // Auto destruction... | 1215 | // Auto destruction... |
1216 | this.destroy().catch(err => logger.error('Cannot destruct video after transcoding failure.', err)) | 1216 | this.destroy().catch(err => logger.error('Cannot destruct video after transcoding failure.', { err })) |
1217 | 1217 | ||
1218 | throw err | 1218 | throw err |
1219 | } | 1219 | } |