pinojs/pino-elasticsearch

can i use pino-elasticsearch as a module

Closed this issue · 3 comments

for example:

const pinoms = require('pino-multi-stream')
const pinoEs = require('pino-elasticsearch')({
    host: '192.168.1.220',
    index: 'zb'
})

const logger = pinoms({
    streams: [
      {level: 'error', stream: process.stderr}, // an "error" level destination stream
      {level: 'info', stream: process.stdout}, // an "info" level destination stream
      {stream: pinoEs}
    ]
  })


logger.info({'msg': {'info': 'info'}})
logger.debug('debug')
logger.warn('warn')
logger.error('error')

I would love to support that! Would you like to send a PR?

for the latest version of pino-elasticsearch,
'node' should be used instead of 'host'

const pinoEs = require('pino-elasticsearch')({ node: '192.168.1.220', index: 'zb' })