• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

visionmedia / debug / 248 / 1
89%
master: 89%

Build:
DEFAULT BRANCH: master
Ran 23 Jan 2018 07:46PM UTC
Files 3
Run time 33min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Jan 2018 07:45PM UTC coverage: 70.43% (-3.4%) from 73.78%
248.1

Pull #544

travis-ci

web-flow
introduce `debug.unique()`

When debugging the applications that work with pools of streams
or sockets, the debug stream often comes out interleaved making it
impossible to distinguish between streams. It is a common knowledge
that unique ids could be assigned to each stream and be used in
logging to solve this. However, this solution is rather ad-hoc and
usually applied only during manual debugging.

Introduce `debug.unique([ format ])` method that returns function with
the same signature as `debug`. This function however prepends either
`'%d '` or `format + ' '` (depending on the presence of `format`) to the
first argument of original `debug` function, and supplies unique
integer as a second argument, shifting the rest to the right.

Example:

```
const debug = require('debug')('ns');

class Instance {
  constructor() {
    this.debug = debug.unique('id=%d ');
  }

  method() {
    this.debug('method data=%j', {});
    // "id=123 method data={}"
  }

  attach(other) {
    this.debug('attach to=%d', other.debug.id());
    // "id=123 attach to=456"
  }
}
```
Pull Request #544: introduce `debug.unique()`

28 of 66 branches covered (42.42%)

131 of 186 relevant lines covered (70.43%)

2.16 hits per line

Source Files on job 248.1
  • Tree
  • List 0
  • Changed 2
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Build 248
  • Travis Job 248.1
  • a495f86a on github
  • Prev Job for on master (#244.1)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc