browserify / watchify

watch mode for browserify builds
Other
1.79k stars 181 forks source link

added -s (--timestamp) option that timestamps each console msg #275

Closed findmory closed 9 years ago

findmory commented 9 years ago

If you include -s or --timestamp to the watchify command you are presented with current time stamped in each console message.
For example:

> watchify index.js --verbose --timestamp -t babelify -o bundle.js -d

yields:

[Sat Oct 17 2015 11:35:21 GMT-0400 (EDT)] 2533958 bytes written to bundle.js (3.86 seconds)
zertosh commented 9 years ago

-s already means --standalone for browserify. I kinda like the idea of making timestamps the default though – let me think about it.

mattdesl commented 9 years ago

Note this might break some tools that have come to depend on the output of watchify, like livereactload.

Another option might be to explore ndjson or bole to give the user full control. The logs could be piped to garnish, bistre, and other tools.

e.g.

watchify index.js -o bundle.js --ndjson | garnish
console.log({
  time: new Date().toISOString(),
  level: 'info',
  name: 'watchify',
  elapsed: 3820,
  message: '2550 bytes written to bundle.js'
});

See budo logs for example, which prints yellow for elapsed time when it goes over a certain threshold. :smile:

zertosh commented 9 years ago

Hm, thanks for the tip @mattdesl! Unfortunately, since watchify has to share its flags browserify (which has a lot), I'm reluctant to add another one.

Sorry @findmory, but this log signature is going to have to stay. However, via the API is it's really easy to build whatever kind of logging you want. Thanks for the PR though!