Skip to content

Commit

Permalink
improve cdp messages debug logging
Browse files Browse the repository at this point in the history
Differential Revision: D70324724
  • Loading branch information
vzaidman authored and facebook-github-bot committed Feb 28, 2025
1 parent f0d4a00 commit b5646be
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
10 changes: 9 additions & 1 deletion flow-typed/npm/debug_v2.x.x.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@
// https://github.com/visionmedia/debug
// https://www.npmjs.com/package/debug

interface DebugFN {
(...args: Array<mixed>): void;
enable(match: string): void;
disable(): void;
enabled: () => boolean;
}

declare module 'debug' {
declare module.exports: {
(namespace: string): (...Array<mixed>) => void,
(namespace: string): DebugFN,
enable(match: string): void,
disable(): void,
enabled: () => boolean,
};
}
11 changes: 9 additions & 2 deletions packages/metro/src/__mocks__/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,15 @@

'use strict';

function debug(namespace: string): (...Array<mixed>) => void {
return () => {};
interface DebugFN {
(...args: Array<mixed>): void;
enabled: () => boolean;
}

function debug(namespace: string): DebugFN {
const fn = (...args: Array<mixed>) => {};
fn.enabled = () => false;
return fn;
}

debug.enable = (match: string) => {};
Expand Down

0 comments on commit b5646be

Please sign in to comment.