Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fire callback to inform winston about log delivery in time #61

Merged
merged 2 commits into from
Jul 19, 2018

Conversation

markablov
Copy link
Contributor

Hey,

process.on('uncaughtException', err => {
  logger.error('uncaughtException', err, {stack: err.stack});
  logger.on('finish', () => process.exit(1));
  logger.end();
});

In this code in case of uncaught exception we could lose logs, because winston-elasticsearch transport calls callback inside log() instantly, but it supposed to do it after log delivery (or an error, but it more complex ;) )

@coveralls
Copy link

Coverage Status

Coverage increased (+1.7%) to 81.25% when pulling de6e51f on markablov:master into 51fa69c on vanthome:master.

@vanthome
Copy link
Owner

Very nice, wanted to do this also but could not find that the bulk writer has callback support immediately.

@vanthome vanthome merged commit 3a70487 into vanthome:master Jul 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants