-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change the way logging is done #55
Comments
//CC @tkellen |
+1 on using an emitter! @cowboy has a lot more experience dealing with building nice loggers, so I'd probably defer to him on this. The logger will have a spec also, but we haven't even approached that yet. |
I would probably not namespace the events (use there are many loggers on npm, should be trivial to hook any of the existing loggers: var task = require('myTask');
// just use the native `console.log` method
['log', 'error', 'info', 'warn', 'debug'].forEach(function(level){
task.on(level, console.log.bind(console, level+':');
}); each runner would take care of implementing a logger, that way we could reuse the same tasks in multiple places (not only on build scripts), sometimes these events might be used by other means besides logs - e.g. each time |
@millermedeiros thanks for the feedback. this.emit('log', 'Hi, Ive a new line\n');
this.emit('log', 'And Ive not'); This could cause |
I like the implementation @satazor posted originally--I definitely want control over newlines when logging and I don't mind the namespaced events. |
At the moment, logging is done via the context. To increase compatibility with the upcoming
node-task
, logging could be done via anemitter
like so:Question: Should we remove the
ln
versions or do it like this:Please note that, the
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/107105-change-the-way-logging-is-done?utm_campaign=plugin&utm_content=tracker%2F39683&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F39683&utm_medium=issues&utm_source=github).context
parameter could be removed completely. Functions would only receiveopts
andnext
.The text was updated successfully, but these errors were encountered: