pliersjs / pliers

A build tool for node.js that supports sub-project building and watching
http://pliers.js.org/
18 stars 9 forks source link

Define log level from the cli #11

Closed serby closed 11 years ago

bengourley commented 11 years ago

What do you want this to look like?

pliers build --loglevel=info?

What about a -q --quiet option?

bengourley commented 11 years ago

What do you think about using https://github.com/isaacs/npmlog as the logger? Then we get log levels for free (just have to wire it up to the CLI option).

The only thing is, npmlog's default log levels are silly, verbose, info, http, warn and error, whereas pliers' current levels are debug, info, warn and error. Should we add 'debug' to npm's or just conform to npms levels?

bengourley commented 11 years ago

Just read up on syslog style and if we are trying to match that style, we're missing a few levels:

emerg, crit, alert, err, warning, notice, info and debug

I've got a local version of pliers linked up with npmlog. It works but I guess it is a bit geared to npm's use case (unsurprisingly):

On the whole it's not v configurable so I think it might not make the most sense. There are a number of logging modules available and I think it makes sense to use one rather than write our own if we can. It would be good to outline what we are looking for in logger in order to choose the best fit.

eg:

(I'm going to town on this because my console is flooded with debug mesages at the moment!)

serby commented 11 years ago

These are the log levels that I prefer

https://github.com/trentm/node-bunyan#levels

On 29 January 2013 15:02, Ben Gourley notifications@github.com wrote:

Just read up on syslog stylehttp://www.freebsd.org/cgi/man.cgi?query=syslog.conf&sektion=5and if we are trying to match that style, we're missing a few levels:

emerg, crit, alert, err, warning, notice, info and debug

I've got a local version of pliers linked up with npmlog. It works but I guess it is a bit geared to npm's use case (unsurprisingly):

  • The log function signature is log[level](prefix, message…) so that's level, prefix and message that you have to pass in
  • You can't unset a log level (so we're stuck with http)
  • You can't alter the output (for instance to include a timstamp, like you currently have) except by swapping in your own stream or listening to log events

On the whole it's not v configurable so I think it might not make the most sense. There are a number of logging modules available and I think it makes sense to use one rather than write our own if we can. It would be good to outline what we are looking for in logger in order to choose the best fit.

eg:

  • set log level

(I'm going to town on this because my console is flooded with debug mesages at the moment!)

— Reply to this email directly or view it on GitHubhttps://github.com/serby/pliers/issues/11#issuecomment-12838531.

paul.serby@clock.co.uk Chief Technology Officer

_Direct: +44 2030 516115__Mobile: +44 7881 550999 *_Skype: paul.serby* *

*