Skip to content

Commit 9ebf27f

Browse files
committed
Merge pull request #14 from goldcaddy77/dev-debug-module
feat(logging): use npm 'debug' module
2 parents a134383 + e375f0c commit 9ebf27f

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

Diff for: README.md

+8
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ e.g.
8484

8585
Please refer to the [tsd.json](https://github.com/DefinitelyTyped/tsd#tsdjson) to get more information.
8686

87+
## DEBUGGING
88+
89+
This library uses the popular [debug](https://github.com/visionmedia/debug) module for debugging. To enable logging, set the `DEBUG` environment variable when running gulp tasks like so:
90+
91+
```
92+
DEBUG=gulp-tsd gulp tsd
93+
```
94+
8795
## NOTES
8896

8997
A lot of codes are from [grunt-tsd](https://github.com/DefinitelyTyped/grunt-tsd). Thanks.

Diff for: index.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var tsd = require('./lib/tsd');
22
var through = require('through2');
33
var gutil = require('gulp-util');
44
var path = require('path');
5+
var debug = require('debug')('gulp-tsd');
56

67
module.exports = function (options, callback) {
78
'use strict';
@@ -13,9 +14,11 @@ module.exports = function (options, callback) {
1314

1415
var logger = {
1516
'log': function () {
16-
var args = Array.prototype.slice.call(arguments);
17-
args.unshift('[' + gutil.colors.cyan('gulp-tsd') + ']');
18-
gutil.log.apply(undefined, args);
17+
var args = Array.prototype.slice.call(arguments),
18+
printfString = Array.apply(null, Array(args.length)).map(function(){return '%o'}).join(' ');
19+
20+
args.unshift(printfString);
21+
debug.apply(null, args);
1922
}
2023
};
2124

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"tsd"
1313
],
1414
"dependencies": {
15+
"debug": "^2.2.0",
1516
"gulp-util": "^3.0.1",
1617
"through2": "^0.6.3",
1718
"tsd": "~0.6.0-beta.4"

0 commit comments

Comments
 (0)