mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 22:30:01 +00:00
[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
This commit is contained in:
committed by
Ron Buckton
parent
e87f5a9181
commit
158e2d3343
@@ -29,3 +29,7 @@ extendedLog("Testing this is also an IDebugger.");
|
||||
|
||||
const extendedWithCustomDelimiter: debug1.Debugger = log.extend('with-delim', '.');
|
||||
extendedWithCustomDelimiter("Testing this is an IDebugger, too.");
|
||||
|
||||
debug2.log = console.log.bind(console);
|
||||
const anotherLogger = debug2("DefinitelyTyped:error");
|
||||
anotherLogger("This should be printed to stdout");
|
||||
|
||||
4
types/debug/index.d.ts
vendored
4
types/debug/index.d.ts
vendored
@@ -5,9 +5,10 @@
|
||||
// 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};
|
||||
declare var debug: debug.Debug & { debug: debug.Debug; default: debug.Debug };
|
||||
|
||||
export = debug;
|
||||
export as namespace debug;
|
||||
@@ -19,6 +20,7 @@ declare namespace debug {
|
||||
disable: () => string;
|
||||
enable: (namespaces: string) => void;
|
||||
enabled: (namespaces: string) => boolean;
|
||||
log: (...args: any[]) => any;
|
||||
|
||||
names: RegExp[];
|
||||
skips: RegExp[];
|
||||
|
||||
Reference in New Issue
Block a user