codeforanchorage / realtime-bus-sms

Text back current arrival time for buses given a texted in bus stop number for People Mover. AddressLookup branch would allow texting "Arctic and Fireweed"
https://bus.codeforanchorage.org
14 stars 10 forks source link

Logging #99

Closed mark-meyer closed 7 years ago

mark-meyer commented 7 years ago

This separates the logging into its own module. It logs all requests with a middleware function. Writing logs is handled by Winston transports which allow writing logs to multiple sources or services. Currently it will log to console, the lowdb files, and now Google Analytics.

tescher commented 7 years ago

Hi Mark. Is this ready or do you have more to do? Looks like Travis is failing because of some newer Node syntax - might need to update the Travis config for this project.

mark-meyer commented 7 years ago

Hi @tescher - I think it's looking good. I added some comments that hopefully will make the workings somewhat clear. The logging to lowdb is in its own module because everything was very specific to the bus app and it didn't make sense to generalize it, but it should be a good model for adding transports to the logger. Please feel free to send any comments you have — I'm happy to keep plugging away on this if there's changes you think would improve it.

The config.js file has a Google Analytics tracking code that's specific to the bus app — Brandan set it up so I think it will be easy to share that data and dashboards between people. You'll want to get a separate tracking ID to use in a different project so we don't mix the data up.

And yes, I think you'll want a relatively new version of Node so you can get the nice ES6 features like ()=> functions and native promises. I think the latest LTS version is 6.9. The version Travis was testing against in the bus app was 0.1!

mark-meyer commented 7 years ago

Also @tescher - I'm planning on using the unit tests Nigel added for the Google geocoder as a model to add some tests for the logging module but I won't have time until this weekend (or maybe even between holidays.)