fix: include full stack traces in error logs

pull/8006/head
derekderie 2 months ago
parent 6f042e97cc
commit 000cfb1b4e

@ -7,6 +7,7 @@ module.exports = {
loggers: {},
init(uid) {
const loggerFormats = [
winston.format.errors({ stack: true }),
winston.format.label({ label: uid }),
winston.format.timestamp()
]
@ -15,7 +16,7 @@ module.exports = {
loggerFormats.push(winston.format.json())
} else {
loggerFormats.push(winston.format.colorize())
loggerFormats.push(winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}`))
loggerFormats.push(winston.format.printf(info => `${info.timestamp} [${info.label}] ${info.level}: ${info.message}${info.stack ? '\n' + info.stack : ''}`))
}
const logger = winston.createLogger({

@ -61,6 +61,6 @@ module.exports = async (localeCode) => {
WIKI.logger.info(`Fetching locale ${localeCode} from Graph endpoint: [ COMPLETED ]`)
} catch (err) {
WIKI.logger.error(`Fetching locale ${localeCode} from Graph endpoint: [ FAILED ]`)
WIKI.logger.error(err.message)
WIKI.logger.error(err)
}
}

@ -27,6 +27,6 @@ module.exports = async () => {
WIKI.logger.info('Purging orphaned upload files: [ COMPLETED ]')
} catch (err) {
WIKI.logger.error('Purging orphaned upload files: [ FAILED ]')
WIKI.logger.error(err.message)
WIKI.logger.error(err)
}
}

@ -73,7 +73,7 @@ module.exports = async (pageId) => {
WIKI.logger.info(`Rebuilding page tree: [ COMPLETED ]`)
} catch (err) {
WIKI.logger.error(`Rebuilding page tree: [ FAILED ]`)
WIKI.logger.error(err.message)
WIKI.logger.error(err)
// exit process with error code
throw err
}

@ -89,7 +89,7 @@ module.exports = async (pageId) => {
WIKI.logger.info(`Rendering page ID ${pageId}: [ COMPLETED ]`)
} catch (err) {
WIKI.logger.error(`Rendering page ID ${pageId}: [ FAILED ]`)
WIKI.logger.error(err.message)
WIKI.logger.error(err)
// exit process with error code
throw err
}

@ -19,7 +19,7 @@ module.exports = async (svgPath) => {
WIKI.logger.info(`Sanitized SVG file upload: [ COMPLETED ]`)
} catch (err) {
WIKI.logger.error(`Failed to sanitize SVG file upload: [ FAILED ]`)
WIKI.logger.error(err.message)
WIKI.logger.error(err)
throw err
}
}

Loading…
Cancel
Save