Skip to content

Commit

Permalink
Ignore pino the worker has exited error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jarvis2f committed Mar 23, 2024
1 parent 4cda6e3 commit 0f0f692
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/server/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import pino, { type Logger } from "pino";
import "pino-abstract-transport";

const targets = [];

targets.push({
target: path.join(process.cwd(), "./src/lib/pino-prisma.mjs"),
options: {},
level: "trace",
});
if (process.env.NODE_ENV === "production") {
// targets.push({
// target: 'pino/file',
Expand All @@ -12,11 +16,6 @@ if (process.env.NODE_ENV === "production") {
// },
// level: 'trace',
// })
targets.push({
target: path.join(process.cwd(), "./src/lib/pino-prisma.mjs"),
options: {},
level: "trace",
});
} else {
targets.push({
target: "pino-pretty",
Expand All @@ -36,6 +35,9 @@ const logger: Logger = pino({
});

process.on("uncaughtException", (err) => {
if (err.message === "the worker has exited") {
return;
}
console.error(err);
if (logger) logger.fatal(err, "uncaught exception detected");
});
Expand Down

0 comments on commit 0f0f692

Please sign in to comment.