brf/server/lib/console.ts
2025-12-13 21:12:08 +01:00

21 lines
619 B
TypeScript

import env from '../env.ts'
if (env.NODE_ENV === 'development') {
// output filename in console log and colour console.dir
// @ts-ignore
await import('@bmp/console').then((mod) => mod.default({ log: true, error: true, dir: true }))
const { default: chalk } = await import('chalk')
process.on('uncaughtException', (err, origin) => {
console.error(chalk.red(`UNCAUGHT EXCEPTION`), chalk.yellow(` (${origin})`))
console.error(err)
})
process.on('unhandledRejection', (err, promise) => {
console.error(chalk.red('UNHANDLED REJECTION'))
console.error(promise)
console.error(err)
})
}