Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(connection): separate send/receive debug logging #6017

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/Connection.ts
Expand Up @@ -16,7 +16,8 @@
import { assert } from './helper';
import { Events } from './Events';
import * as debug from 'debug';
const debugProtocol = debug('puppeteer:protocol');
const debugProtocolSend = debug('puppeteer:protocol:SEND ►');
const debugProtocolReceive = debug('puppeteer:protocol:RECV ◀');

import Protocol from './protocol';
import { ConnectionTransport } from './ConnectionTransport';
Expand Down Expand Up @@ -78,14 +79,14 @@ export class Connection extends EventEmitter {
_rawSend(message: {}): number {
const id = ++this._lastId;
message = JSON.stringify(Object.assign({}, message, { id }));
debugProtocol('SEND ► ' + message);
debugProtocolSend(message);
this._transport.send(message);
return id;
}

async _onMessage(message: string): Promise<void> {
if (this._delay) await new Promise((f) => setTimeout(f, this._delay));
debugProtocol('◀ RECV ' + message);
debugProtocolReceive(message);
const object = JSON.parse(message);
if (object.method === 'Target.attachedToTarget') {
const sessionId = object.params.sessionId;
Expand Down