1
0
mirror of https://github.com/nttgin/BGPalerter.git synced 2024-05-19 06:50:08 +00:00

trycatch in case the log stream is not available

This commit is contained in:
Massimo Candela
2020-12-09 04:38:37 +01:00
parent 1012ffb569
commit 33540b7147

View File

@@ -68,12 +68,15 @@ export default class FileLogger {
};
log = (data) => {
try {
const item = this.format({
timestamp: this.getCurrentDate().format('YYYY-MM-DDTHH:mm:ssZ'),
data
});
this.stream.write(item + "\n");
} catch (error) {
console.log(data);
console.log(error);
}
};
};