Skip to main content
Version: 1.15

Logger

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 === 'browser',      log: (name, severity, message, args) => console.log(`${name} ${message}`)    }  });  ...})();

logger.isEnabled(name, severity)#

  • name <string> logger name#
  • severity <"verbose"|"info"|"warning"|"error">#
  • returns: <boolean>#

Determines whether sink is interested in the logger with the given name and severity.

logger.log(name, severity, message, args, hints)#

  • name <string> logger name#
  • severity <"verbose"|"info"|"warning"|"error">#
  • message <string|Error> log message format#
  • args <Array<Object>> message arguments#
  • hints <Object> optional formatting hints#
    • color <string> Optional preferred logger color.
  • returns: <void>#