From 0794fe2ac1e2a835bdfd58350a9de0fb04e31238 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Apr 2024 09:17:45 +0200 Subject: [PATCH] Fix runner ffmpeg logger --- .../server/process/shared/transcoding-logger.ts | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/apps/peertube-runner/src/server/process/shared/transcoding-logger.ts b/apps/peertube-runner/src/server/process/shared/transcoding-logger.ts index 041dd62eb..d0775e13b 100644 --- a/apps/peertube-runner/src/server/process/shared/transcoding-logger.ts +++ b/apps/peertube-runner/src/server/process/shared/transcoding-logger.ts @@ -1,10 +1,19 @@ +import { LogFn } from 'pino' import { logger } from '../../../shared/index.js' export function getTranscodingLogger () { return { - info: logger.info.bind(logger), - debug: logger.debug.bind(logger), - warn: logger.warn.bind(logger), - error: logger.error.bind(logger) + info: buildWinstonLogger(logger.info.bind(logger)), + debug: buildWinstonLogger(logger.debug.bind(logger)), + warn: buildWinstonLogger(logger.warn.bind(logger)), + error: buildWinstonLogger(logger.error.bind(logger)) + } +} + +function buildWinstonLogger (log: LogFn) { + return (arg1: string, arg2?: object) => { + if (arg2) return log(arg2, arg1) + + return log(arg1) } }