mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-22 07:43:08 +02:00
feat: add prisma logging
This commit is contained in:
parent
ff8e66638a
commit
3b5e58c1fe
@ -52,8 +52,21 @@ module.exports = class Client extends FrameworkClient {
|
||||
}
|
||||
|
||||
async login(token) {
|
||||
const levels = ['error', 'info', 'warn'];
|
||||
if (this.config.logs.level === 'debug') levels.push('query');
|
||||
|
||||
/** @type {PrismaClient} */
|
||||
this.prisma = new PrismaClient();
|
||||
this.prisma = new PrismaClient({
|
||||
log: levels.map(level => ({
|
||||
emit: 'event',
|
||||
level,
|
||||
})),
|
||||
});
|
||||
|
||||
this.prisma.$on('error', e => this.log.error.prisma(`${e.target} ${e.message}`));
|
||||
this.prisma.$on('info', e => this.log.info.prisma(`${e.target} ${e.message}`));
|
||||
this.prisma.$on('warn', e => this.log.warn.prisma(`${e.target} ${e.message}`));
|
||||
this.prisma.$on('query', e => this.log.debug.prisma(e));
|
||||
|
||||
if (process.env.DB_PROVIDER === 'sqlite') {
|
||||
// rewrite queries that use unsupported features
|
||||
|
@ -58,6 +58,7 @@ module.exports = config => {
|
||||
'listeners',
|
||||
'menus',
|
||||
'modals',
|
||||
'prisma',
|
||||
'settings',
|
||||
'tickets',
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user