smart-facility / cognicity-reports-powertrack

cognicity-reports: NodeJS app - Twitter & GNIP PowerTrack support for the CogniCity framework
5 stars 4 forks source link

Log messages just before exit are not always written #3

Open benatwork99 opened 9 years ago

benatwork99 commented 9 years ago

If we call a winston log method just before process.exit the log message is not always written to the file.

There is an open issue on Winston for this: https://github.com/flatiron/winston/issues/228

And it seems to come back to node.js file writing and Winston being an asynchronous logger.

The callback method does not work reliably for us (as noted in the issue). Adding a small delay before the process.exit does seem to work but feels hacky.

benatwork99 commented 9 years ago

Worked around this temporarily by adding a small delay before exit to allow logger to write