fix: browser logging (#6331)

This commit is contained in:
Yury Semikhatsky 2021-04-26 16:20:38 -07:00 committed by GitHub
parent 3c126024ca
commit b6b2366d2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,8 @@ import { Firefox } from './firefox/firefox';
import { Selectors, serverSelectors } from './selectors';
import { WebKit } from './webkit/webkit';
import { Registry } from '../utils/registry';
import { createInstrumentation, SdkObject } from './instrumentation';
import { CallMetadata, createInstrumentation, SdkObject } from './instrumentation';
import { debugLogger } from '../utils/debugLogger';
export class Playwright extends SdkObject {
readonly selectors: Selectors;
@ -37,6 +38,11 @@ export class Playwright extends SdkObject {
constructor(isInternal: boolean) {
super({ attribution: { isInternal }, instrumentation: createInstrumentation() } as any, undefined, 'Playwright');
this.instrumentation.addListener({
onCallLog: (logName: string, message: string, sdkObject: SdkObject, metadata: CallMetadata) => {
debugLogger.log(logName as any, message);
}
});
this.options = {
registry: new Registry(path.join(__dirname, '..', '..')),
rootSdkObject: this,