Logger
Deprecated
This class is deprecated. The logs pumped through this class are incomplete. Please use tracing instead.
Playwright 生成大量日志,并且可以通过插件化日志器接收器访问它们。
🌐 Playwright generates a lot of logs and they are accessible via the pluggable logger sink.
const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
(async () => {
const browser = await chromium.launch({
logger: {
isEnabled: (name, severity) => name === 'api',
log: (name, severity, message, args) => console.log(`${name} ${message}`)
}
});
// ...
})();
方法
🌐 Methods
isEnabled
Added before v1.9确定接收器是否对具有给定名称和严重性的日志器感兴趣。
🌐 Determines whether sink is interested in the logger with the given name and severity.
用法
logger.isEnabled(name, severity);
参数
返回
log
Added before v1.9用法
logger.log(name, severity, message, args, hints);
参数