Check data before log

This commit is contained in:
Douglas Barone 2021-01-07 09:55:21 -04:00
parent 9de555c361
commit d97dd315f8
2 changed files with 2 additions and 2 deletions

View File

@ -27,7 +27,7 @@ async function log({ level, tags = [], message = '', data }, store = true) {
level,
tags: tags.toString(),
message,
data: JSON.decycle(data)
data: data ? JSON.decycle(data) : null
}
})
} catch (e) {

View File

@ -1,6 +1,6 @@
const Log = {
timestamp: parent => parent.timestamp?.toISOString(),
data: parent => JSON.stringify(parent.data),
data: parent => (parent.data ? JSON.stringify(parent.data) : null),
tags: parent => parent.tags?.split(',')
}