-
Notifications
You must be signed in to change notification settings - Fork 153
repaired the ability of nano to be able to output DEBUG messages #286
base: master
Are you sure you want to change the base?
Changes from 1 commit
5dbfaa6
04386c1
d1c7554
45d58bf
225f151
3a5a758
4aac563
93db52d
118e209
f757cdd
6b5d723
a255f68
3db2d95
6be3aec
cb870b8
939c980
4e38f22
29bc803
32cc15c
a20fb95
e7f532c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,18 +11,12 @@ | |
| // the License. | ||
|
|
||
| 'use strict'; | ||
| var prefix = 'nano'; | ||
| var debug = require('debug')(prefix); | ||
|
|
||
| var debug = require('debug')('nano/logger'); | ||
|
|
||
| module.exports = function logging(cfg) { | ||
| var log = cfg && cfg.log; | ||
| var logStrategy = typeof log === 'function' ? log : debug; | ||
|
|
||
| return function logEvent(prefix) { | ||
| var eventId = (prefix ? prefix + '-' : '') + | ||
| (~~(Math.random() * 1e9)).toString(36); | ||
| return function log() { | ||
| logStrategy.call(this, eventId, [].slice.call(arguments, 0)); | ||
| }; | ||
| module.exports = function logging() { | ||
| return function log() { | ||
| var eventId = prefix + (~~(Math.random() * 1e9)).toString(36); | ||
| debug.call(this, eventId, [].slice.call(arguments, 0)); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for the pull request. however i'm confused by this. the log function is normally used to log, and during development can be overridden by debug. seems like this just makes it be a debug message all the time no? |
||
| }; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,12 +19,7 @@ var harness = helpers.harness(__filename); | |
| var it = harness.it; | ||
|
|
||
| it('should be able to instantiate a log', function(assert) { | ||
| var log = logger({ | ||
| log: function(id, msg) { | ||
| assert.equal(typeof id, 'string', 'id is set `' + id + '`'); | ||
| assert.equal(msg[0], 'testing 1234'); | ||
| assert.end(); | ||
| } | ||
| })(); | ||
| log('testing 1234'); | ||
| var log = logger(); | ||
| assert.equal(typeof log, 'function'); | ||
| assert.end(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. once again, seems like you removed api stable behavior and replaced it with what was convenient for your use case? while you might not like the behavior, many people might be relying on it in production and we can't do breaking changes like this if you have a rationale for it please explain, maybe a breaking version can be released then |
||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docs. always great 👍