add additional info in debug logs

This commit is contained in:
Feross Aboukhadijeh 2019-08-11 14:32:15 -07:00
parent 8381502f3c
commit da70afd3b3

View File

@ -127,9 +127,9 @@ class Client extends EventEmitter {
* @param {number=} opts.left (if not set, calculated automatically)
*/
start (opts) {
debug('send `start`')
opts = this._defaultAnnounceOpts(opts)
opts.event = 'started'
debug('send `start` %o', opts)
this._announce(opts)
// start announcing on intervals
@ -147,9 +147,9 @@ class Client extends EventEmitter {
* @param {number=} opts.left (if not set, calculated automatically)
*/
stop (opts) {
debug('send `stop`')
opts = this._defaultAnnounceOpts(opts)
opts.event = 'stopped'
debug('send `stop` %o', opts)
this._announce(opts)
}
@ -162,10 +162,10 @@ class Client extends EventEmitter {
* @param {number=} opts.left (if not set, calculated automatically)
*/
complete (opts) {
debug('send `complete`')
if (!opts) opts = {}
opts = this._defaultAnnounceOpts(opts)
opts.event = 'completed'
debug('send `complete` %o', opts)
this._announce(opts)
}
@ -178,9 +178,9 @@ class Client extends EventEmitter {
* @param {number=} opts.left (if not set, calculated automatically)
*/
update (opts) {
debug('send `update`')
opts = this._defaultAnnounceOpts(opts)
if (opts.event) delete opts.event
debug('send `update` %o', opts)
this._announce(opts)
}