DefinitelyTyped/types/debug/index.d.ts
Kristian Brünn 158e2d3343 [debug] Override all per-namespace log settings (#34234)
* extend the Debug interface with log(...args) to enable overriding all per-namespace log settings

* extend author list of debug

* extend debug tests

* nits: replace console.error with console.log
2019-03-27 17:27:38 -07:00

48 lines
1.4 KiB
TypeScript

// Type definitions for debug 4.1
// Project: https://github.com/visionmedia/debug
// Definitions by: Seon-Wook Park <https://github.com/swook>
// Gal Talmor <https://github.com/galtalmor>
// John McLaughlin <https://github.com/zamb3zi>
// Brasten Sager <https://github.com/brasten>
// Nicolas Penin <https://github.com/npenin>
// Kristian Brünn <https://github.com/kristianmitk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
export = debug;
export as namespace debug;
declare namespace debug {
interface Debug {
(namespace: string): Debugger;
coerce: (val: any) => any;
disable: () => string;
enable: (namespaces: string) => void;
enabled: (namespaces: string) => boolean;
log: (...args: any[]) => any;
names: RegExp[];
skips: RegExp[];
formatters: Formatters;
}
type IDebug = Debug;
interface Formatters {
[formatter: string]: (v: any) => string;
}
type IDebugger = Debugger;
interface Debugger {
(formatter: any, ...args: any[]): void;
enabled: boolean;
log: (...args: any[]) => any;
namespace: string;
extend: (namespace: string, delimiter?: string) => Debugger;
}
}