Socket
Socket
Sign inDemoInstall

dbug

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dbug - npm Package Compare versions

Comparing version 0.0.0 to 0.1.0

.npmignore

11

package.json
{
"name": "dbug",
"version": "0.0.0",
"version": "0.1.0",
"description": "debug improvements",

@@ -10,4 +10,5 @@ "main": "./lib/dbug.js",

"devDependencies": {
"mocha": "*"
"mocha": "1.x"
},
"readmeFilename": "README.md",
"keywords": [

@@ -21,3 +22,9 @@ "debug",

"author": "Sean McArthur <sean.monstar@gmail.com> (http://seanmonstar.com)",
"bugs": "https://github.com/seanmonstar/dbug/issues",
"homepage": "https://github.com/seanmonstar/dbug",
"repository": {
"type": "git",
"url": "https://github.com/seanmonstar/dbug.git"
},
"license": "MPLv2.0"
}
# dbug
[![Build Status](https://travis-ci.org/seanmonstar/dbug.png?branch=master)](https://travis-ci.org/seanmonstar/dbug)
[![NPM version](https://badge.fury.io/js/dbug.png)](http://badge.fury.io/js/dbug)
A drop-in replacement for [debug][], for slightly more utility.
```js
var dbug = require('dbug')('foo:bar');
dbug('just like debug'); // except goes to stdout, not stderr
dbug(new Error('also like debug'));
// additional methods
dbug.info('info');
dbug.warn('warning');
dbug.error('red alert');
```
Just like debug, `dbug` won't do anything unless the `DEBUG` env variable matches the `dbug` logger, but with slightly more lenient matching.
```
DEBUG=*
DEBUG=foo,quux
DEBUG=foo // also acts as foo:*
```
[debug]: https://npmjs.org/package/debug

@@ -12,3 +12,2 @@ /* This Source Code Form is subject to the terms of the Mozilla Public

const stdout = {

@@ -28,7 +27,20 @@ lastWrite: '',

// XXX: v0.8 support. remove when dropped
var out = process.stdout.write;
var err = process.stderr.write;
function testOut(v) {
stdout.lastWrite = v;
return true;
}
function testErr(v) {
stderr.lastWrite = v;
return true;
}
module.exports = {
'dbug': {
'before': function() {
console._stdout = stdout;
console._stderr = stderr;
//console._stdout = stdout;
//console._stderr = stderr;
},

@@ -62,2 +74,5 @@ 'matching': {

process.stdout.write = testOut;
process.stderr.write = testErr;
function contains(haystack, needle) {

@@ -81,2 +96,5 @@ return haystack.indexOf(needle) !== -1;

assert(contains(stderr.lastWrite, 'foo.error'));
process.stdout.write = out;
process.stderr.write = err;
},

@@ -97,2 +115,5 @@

'should be disabled': function() {
process.stdout.write = testOut;
process.stderr.write = testErr;
assert(!bar.enabled);

@@ -103,2 +124,5 @@ bar('a');

assert.notEqual(stdout.lastWrite, 'b');
process.stdout.write = out;
process.stderr.write = err;
}

@@ -108,6 +132,6 @@ },

'after': function() {
console._stdout = process.stdout;
console._stderr = process.stderr;
//console._stdout = process.stdout;
//console._stderr = process.stderr;
}
}
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc