solidusjs / devtools-solidus

0 stars 0 forks source link

Add Server Error Logs #1

Closed localjo closed 10 years ago

localjo commented 10 years ago

Surface server-level errors into DevTools so that users can debug more quickly.

Also mentioned in solidusjs/solidus#61

pushred commented 10 years ago

The current state of logging affairs looks like:

[SOLIDUS] /events preprocessed in 0ms
[SOLIDUS] Requested resource: [200] http://proxy.storyteller.io/facebook/ufcfightclub/events?fields=name%2Clocation%2Cdescription%2Cvenue%2Cattending.fields(name%2Cpicture)
[SOLIDUS] Requested resource: [200] https://services.sparkart.net/api/v1/events?scope=upcoming&key=d828a4cb-f8a7-4bf5-a5bb-5a9eed9c27cb
[SOLIDUS] Requested resource: [200] http://staging.proxy.storyteller.io/ufc-com/event/ufcFightClubFeed
[SOLIDUS] /resources/events resources fetched in 458ms
[SOLIDUS] Running preprocessor for resources/events/index.hbs
[SOLIDUS] /resources/events preprocessed in 200ms

... and when things are on :fire:

[SOLIDUS] Running preprocessor for resources/events/index.hbs
[SOLIDUS] Preprocessor Error:
TypeError: Cannot read property 'feed' of undefined
    at eval (eval at <anonymous> (/vagrant/ufcfightclub.com/node_modules/solidus/lib/preprocessor_worker.js:12:40), <anonymous>:6:47)
    at module.exports (/vagrant/ufcfightclub.com/node_modules/solidus/lib/preprocessor_worker.js:12:46)
    at handle (/vagrant/ufcfightclub.com/node_modules/solidus/node_modules/worker-farm/lib/child/index.js:37:8)
    at process.<anonymous> (/vagrant/ufcfightclub.com/node_modules/solidus/node_modules/worker-farm/lib/child/index.js:43:3)
    at process.EventEmitter.emit (events.js:98:17)
    at handleMessage (child_process.js:318:10)
    at Pipe.channel.onread (child_process.js:345:11)

Improving these messages in general is a bigger, separate project, but we may need to explore moving to a logger library at the very least here to help get structured data and open a socket to stream the logs to you. The current implementation is pretty barebones, solely built for outputting to the terminal from a dev server. Something like bunyan, winston, or caterpillar. cc @joanniclaborde

joanniclaborde commented 10 years ago

Here's a Solidus pull request for this, using socket.io: https://github.com/solidusjs/solidus/pull/113

If this library doesn't work for you, we can always try with another one.