Merge pull request #3028 from swook/master

Add visionmedia/debug, a tiny npm package for debugging
This commit is contained in:
Masahiro Wakame
2014-10-27 12:02:22 +09:00
3 changed files with 51 additions and 0 deletions
+1
View File
@@ -69,6 +69,7 @@ All definitions files include a header with the author and editors, so at some p
* [Crossfilter](https://github.com/square/crossfilter) (by [Schmulik Raskin](https://github.com/schmuli))
* [crypto-js](https://code.google.com/p/crypto-js/) (by [Gia Bảo @ Sân Đình](https://github.com/giabao)). @see [cryptojs.d.ts repo](https://github.com/giabao/cryptojs.d.ts)
* [d3.js](http://d3js.org/) (from TypeScript samples)
* [debug](https://github.com/visionmedia/debug) (by [Seon-Wook Park](https://github.com/swook))
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [diff](https://github.com/kpdecker/jsdiff) (by [vvakame](http://github.com/vvakame))
+20
View File
@@ -0,0 +1,20 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="debug.d.ts" />
import debug = require("debug");
debug.disable();
debug.enable("DefinitelyTyped:*");
var log: debug.Debugger = debug("DefinitelyTyped:log");
log("Just text");
log("Formatted test (%d arg)", 1);
log("Formatted %s (%d args)", "test", 2);
log("Enabled?: %s", debug.enabled("DefinitelyTyped:log"));
log("Namespace: %s", log.namespace);
var error: debug.Debugger = debug("DefinitelyTyped:error");
error.log = console.error.bind(console);
error("This should be printed to stderr");
+30
View File
@@ -0,0 +1,30 @@
// Type definitions for debug
// Project: https://github.com/visionmedia/debug
// Definitions by: Seon-Wook Park <https://github.com/swook>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "debug" {
function d(namespace: string): d.Debugger;
module d {
export var log: Function;
function enable(namespaces: string): void;
function disable(): void;
function enabled(namespace: string): boolean;
export interface Debugger {
(formatter: any, ...args: any[]): void;
enabled: boolean;
log: Function;
namespace: string;
}
}
export = d;
}