fix: Include Error properties in logs
This commit is contained in:
committed by
Gregor Martynus
parent
ad2e1d76b7
commit
c90765e10d
+1
-1
@@ -52,7 +52,7 @@ module.exports = async () => {
|
||||
logger.log(`%s ${err.message}`, err.code);
|
||||
} else {
|
||||
process.exitCode = 1;
|
||||
logger.error(err);
|
||||
logger.error('An error occurred while running semantic-release: %O', err);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
+8
-3
@@ -6,13 +6,18 @@ const chalk = require('chalk');
|
||||
module.exports = {
|
||||
log(...args) {
|
||||
const [format, ...rest] = args;
|
||||
console.log(`${chalk.grey('[Semantic release]:')} ${format}`, ...rest.map(arg => chalk.magenta(arg)));
|
||||
console.log(
|
||||
`${chalk.grey('[Semantic release]:')}${typeof format === 'string'
|
||||
? ` ${format.replace(/%[^%]/g, seq => chalk.magenta(seq))}`
|
||||
: ''}`,
|
||||
...(typeof format === 'string' ? [] : [format]).concat(rest)
|
||||
);
|
||||
},
|
||||
error(...args) {
|
||||
const [format, ...rest] = args;
|
||||
console.error(
|
||||
`${chalk.grey('[Semantic release]:')} ${chalk.red(format instanceof Error ? format.stack : format)}`,
|
||||
...rest.map(arg => chalk.red(arg instanceof Error ? arg.stack : arg))
|
||||
`${chalk.grey('[Semantic release]:')}${typeof format === 'string' ? ` ${chalk.red(format)}` : ''}`,
|
||||
...(typeof format === 'string' ? [] : [format]).concat(rest)
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user