dbgate/integration-tests/setupTests.js
Jan Prochazka e54bd1da3f logs
2024-09-12 08:43:34 +02:00

23 lines
514 B
JavaScript

const { prettyFactory } = require('pino-pretty');
const pretty = prettyFactory({
colorize: true,
translateTime: 'SYS:standard',
ignore: 'pid,hostname',
});
global.console = {
...console,
log: (...messages) => {
try {
const parsedMessage = JSON.parse(messages[0]);
process.stdout.write(pretty(parsedMessage));
} catch (error) {
process.stdout.write(messages.join(' ') + '\n');
}
},
debug: (...messages) => {
process.stdout.write(messages.join(' ') + '\n');
},
};