mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Add visionmedia/debug, a tiny npm package for debugging
This commit is contained in:
parent
bd9a1922e4
commit
fe09ccfd68
20
debug/debug-tests.ts
Normal file
20
debug/debug-tests.ts
Normal 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
debug/debug.d.ts
vendored
Normal file
30
debug/debug.d.ts
vendored
Normal 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;
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user