From 276d03ed1a469fd4e3579f92392b6f9a1567d1ca Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 21 Feb 2018 10:07:02 +0100 Subject: Unlisted videos are not displayed on Mastodon now --- server/helpers/logger.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'server/helpers/logger.ts') diff --git a/server/helpers/logger.ts b/server/helpers/logger.ts index bcd4885af..7d1d72f29 100644 --- a/server/helpers/logger.ts +++ b/server/helpers/logger.ts @@ -21,7 +21,7 @@ function keysExcluder (key, value) { return excludedKeys[key] === true ? undefined : value } -const loggerFormat = winston.format.printf(info => { +const consoleLoggerFormat = winston.format.printf(info => { let additionalInfos = JSON.stringify(info, keysExcluder, 2) if (additionalInfos === '{}') additionalInfos = '' else additionalInfos = ' ' + additionalInfos @@ -30,6 +30,12 @@ const loggerFormat = winston.format.printf(info => { return `[${info.label}] ${info.timestamp} ${info.level}: ${info.message}${additionalInfos}` }) +const jsonLoggerFormat = winston.format.printf(info => { + if (info.message && info.message.stack !== undefined) info.message = info.message.stack + + return JSON.stringify(info) +}) + const timestampFormatter = winston.format.timestamp({ format: 'YYYY-MM-dd HH:mm:ss.SSS' }) @@ -49,18 +55,18 @@ const logger = new winston.createLogger({ timestampFormatter, labelFormatter, winston.format.splat(), - winston.format.json() + jsonLoggerFormat ) }), new winston.transports.Console({ - handleExceptions: true, + handleExcegiptions: true, humanReadableUnhandledException: true, format: winston.format.combine( timestampFormatter, winston.format.splat(), labelFormatter, winston.format.colorize(), - loggerFormat + consoleLoggerFormat ) }) ], @@ -72,6 +78,6 @@ const logger = new winston.createLogger({ export { timestampFormatter, labelFormatter, - loggerFormat, + consoleLoggerFormat, logger } -- cgit v1.2.3