loglevel-plugin-remote icon indicating copy to clipboard operation
loglevel-plugin-remote copied to clipboard

Configure property name `queue.content` if JSON mode

Open jnnwnk opened this issue 5 years ago • 0 comments

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')
}

jnnwnk avatar Sep 08 '20 15:09 jnnwnk