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

visionmedia / debug / 248
89%

Build:
DEFAULT BRANCH: master
Ran 23 Jan 2018 07:46PM UTC
Jobs 3
Files 3
Run time 34min
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

pending completion
248

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%)

28 of 28 new or added lines in 1 file covered. (100.0%)

131 of 186 relevant lines covered (70.43%)

6.48 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
15
100.0
src/common.js

Uncovered Existing Lines

Lines Coverage ∆ File
2
100.0
src/common.js
3
100.0
src/node.js
Jobs
ID Job ID Ran Files Coverage
1 248.1 23 Jan 2018 07:46PM UTC 0
70.43
Travis Job 248.1
2 248.2 23 Jan 2018 07:47PM UTC 0
70.43
Travis Job 248.2
3 248.3 23 Jan 2018 07:47PM UTC 0
70.43
Travis Job 248.3
Source Files on build 248
Detailed source file information is not available for this build.
  • Back to Repo
  • Travis Build #248
  • Pull Request #544
  • PR Base - master (#244)
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