mirror of
https://github.com/QingWei-Li/notea.git
synced 2024-11-29 12:53:00 +03:00
fix(debug): Make log file not crash the entire instance if it can't be created
This commit is contained in:
parent
ad1d7888ba
commit
96ac878294
@ -58,15 +58,20 @@ function getLogFile(name: string) {
|
||||
}
|
||||
|
||||
const loggerTransport: Parameters<typeof pino.multistream>[0] = [
|
||||
{
|
||||
stream: fs.createWriteStream(getLogFile('debug'), { flags: 'a' }),
|
||||
level: "debug"
|
||||
},
|
||||
{
|
||||
stream: pinoPretty(),
|
||||
level: "info"
|
||||
}
|
||||
];
|
||||
try {
|
||||
loggerTransport.push({
|
||||
stream: fs.createWriteStream(getLogFile('debug'), { flags: 'a' }),
|
||||
level: "debug"
|
||||
});
|
||||
} catch (e) {
|
||||
// well, whoops!
|
||||
console.warn("No file logs: %O", e);
|
||||
}
|
||||
|
||||
const multistream = pino.multistream(loggerTransport);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user