Skip to content

Commit

Permalink
Fix usage of steam, added logging of json errors (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
kammerjaeger authored Jul 4, 2021
1 parent ab54e60 commit f152b7f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ function start (opts) {

const stream = pinoElasticSearch(opts)

stream.on('unknown', (line, error) => {
console.error('Elasticsearch client json error in line:\n' + line + '\nError:', error)
})
stream.on('error', (error) => {
console.error('Elasticsearch client error:', error)
})
Expand All @@ -45,7 +48,7 @@ function start (opts) {
if (opts.rejectUnauthorized) {
opts.rejectUnauthorized = opts.rejectUnauthorized !== 'false'
}
pump(process.stdin, pinoElasticSearch(opts))
pump(process.stdin, stream)
}

const flags = minimist(process.argv.slice(2), {
Expand Down

0 comments on commit f152b7f

Please sign in to comment.