fix: missing logs on OnApplicationBootstrap hook (#1882)
* - fix: set default Nest logger and bufferLogs to false for pino compatibility - handle redis error event * fix collab server logging too
This commit is contained in:
parent
74e915546b
commit
60501de992
4 changed files with 15 additions and 3 deletions
|
|
@ -79,6 +79,8 @@ export class RedisSyncExtension<TCE extends CustomEvents> implements Extension {
|
||||||
this.customEvents = (customEvents as any) ?? ({} as any as CustomEvents);
|
this.customEvents = (customEvents as any) ?? ({} as any as CustomEvents);
|
||||||
this.sub.subscribe(this.msgChannel, `${this.msgChannel}:${this.serverId}`);
|
this.sub.subscribe(this.msgChannel, `${this.msgChannel}:${this.serverId}`);
|
||||||
this.sub.on('messageBuffer', this.handleRedisMessage);
|
this.sub.on('messageBuffer', this.handleRedisMessage);
|
||||||
|
this.pub.on('error', () => {});
|
||||||
|
this.sub.on('error', () => {});
|
||||||
}
|
}
|
||||||
private getKey(documentName: string) {
|
private getKey(documentName: string) {
|
||||||
return `${this.lockPrefix}:${documentName}`;
|
return `${this.lockPrefix}:${documentName}`;
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,8 @@ async function bootstrap() {
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
bufferLogs: true,
|
logger: false,
|
||||||
|
bufferLogs: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,11 @@ async function bootstrap() {
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
rawBody: true,
|
rawBody: true,
|
||||||
bufferLogs: true,
|
// disable Nest logger so pino handles all logs
|
||||||
|
// bufferLogs must be false else pino will fail
|
||||||
|
// to log OnApplicationBootstrap logs
|
||||||
|
logger: false,
|
||||||
|
bufferLogs: false,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -101,7 +105,9 @@ async function bootstrap() {
|
||||||
|
|
||||||
const port = process.env.PORT || 3000;
|
const port = process.env.PORT || 3000;
|
||||||
await app.listen(port, '0.0.0.0', () => {
|
await app.listen(port, '0.0.0.0', () => {
|
||||||
logger.log(`Listening on http://127.0.0.1:${port} / ${process.env.APP_URL}`);
|
logger.log(
|
||||||
|
`Listening on http://127.0.0.1:${port} / ${process.env.APP_URL}`,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,9 @@ export class WsRedisIoAdapter extends IoAdapter {
|
||||||
const pubClient = new Redis(process.env.REDIS_URL, options);
|
const pubClient = new Redis(process.env.REDIS_URL, options);
|
||||||
const subClient = new Redis(process.env.REDIS_URL, options);
|
const subClient = new Redis(process.env.REDIS_URL, options);
|
||||||
|
|
||||||
|
pubClient.on('error', (err) => () => {});
|
||||||
|
subClient.on('error', (err) => () => {});
|
||||||
|
|
||||||
this.adapterConstructor = createAdapter(pubClient, subClient);
|
this.adapterConstructor = createAdapter(pubClient, subClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue