loglevel-plugin-remote
loglevel-plugin-remote copied to clipboard
Configure property name `queue.content` if JSON mode
We'd like to send the log messages to a CouchDB.
Bulk insert is supported by CouchDB. But the payload requires a property named docs (instead of logs).
What about a config value for property name (see https://github.com/kutuluk/loglevel-plugin-remote/blob/master/src/remote.js#L272)
Something like (not tested, might be buggy and is more like pseudo code)
if (isJSON) {
let logsPropertyName = config.logPropertyName || "logs"
queue.content = {}
queue.content[logsPropertyName] = [${logs.join(',')}]
} else {
queue.content = logs.join('\n')
}