Skip to content

Commit

Permalink
Use our debug wrapper rather than Node's debug.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfranklin committed Jun 16, 2020
1 parent 5e29629 commit b11fdb8
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/BrowserFetcher.ts
Expand Up @@ -23,7 +23,7 @@ import * as https from 'https';
import * as http from 'http';

import extractZip from 'extract-zip';
import debug from 'debug';
import { debug } from './Debug';
import removeRecursive from 'rimraf';
import * as URL from 'url';
import ProxyAgent from 'https-proxy-agent';
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.ts
Expand Up @@ -15,7 +15,7 @@
*/
import { assert } from './assert';
import { Events } from './Events';
import debug from 'debug';
import { debug } from './Debug';
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');

Expand Down
4 changes: 2 additions & 2 deletions src/Debug.ts
Expand Up @@ -14,6 +14,8 @@
* limitations under the License.
*/

const isNodeEnv = typeof document === 'undefined';

/**
* A debug function that can be used in any environment.
*
Expand All @@ -32,8 +34,6 @@
* ```
*/
export const debug = (prefix: string): ((...args: unknown[]) => void) => {
const isNodeEnv = typeof document === 'undefined';

if (isNodeEnv) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
return require('debug')(prefix);
Expand Down
2 changes: 1 addition & 1 deletion src/helper.ts
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/
import { TimeoutError } from './Errors';
import debug from 'debug';
import { debug } from './Debug';
import * as fs from 'fs';
import { CDPSession } from './Connection';
import { promisify } from 'util';
Expand Down
2 changes: 1 addition & 1 deletion src/launcher/BrowserRunner.ts
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import debug from 'debug';
import { debug } from '../Debug';

import removeFolder from 'rimraf';
import * as childProcess from 'child_process';
Expand Down

0 comments on commit b11fdb8

Please sign in to comment.