Context:
Code Snippet
const browser = await playwright[browserType].launch({ headless: false, dumpio: true });
Describe the bug
This was not a compile error before (0.12.1), but seems now.
Hey,
dumpio was removed (#1861) in 0.14 and replaced by the logger sink API. Unfortunately not mentioned in the docs directly with the dumpio keyword.
Example Usage: https://playwright.dev/#version=v0.15.0&path=docs%2Fapi.md&q=class-logger
@mxschmitt thanks, what would be an example for getting the dumpio: true behaviour?
@mxschmitt thanks, what would be an example for getting the
dumpio: truebehaviour?
Probably something like that: https://try.playwright.tech/?s=71xa6
Code:
const playwright = require("playwright");
(async () => {
const browser = await playwright.chromium.launch({
logger: {
isEnabled: () => true,
log: (name, severity, message, args) => console.log(name, message)
}
});
const context = await browser.newContext();
const page = await context.newPage();
await page.goto('https://code.visualstudio.com');
await page.screenshot({ path: `example.png` });
await browser.close();
})();
That will lead to that all messages will be logged to the console.
Via the isEnabled callback, you can filter if you only want to get browser or protocol logs.
Thanks, I will give that a try.
Debug logging is now configured via the environment:
DEBUG=pw:browser* node test.js
And for more complex scenarios you can use the logger sink in the api.
Most helpful comment
Debug logging is now configured via the environment:
And for more complex scenarios you can use the
loggersink in the api.