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

Hierarchy

  • Logger

Methods

Methods

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

    Parameters

    • name: string

      logger name

    • severity: "error" | "info" | "verbose" | "warning"

    Returns boolean

  • Parameters

    • name: string

      logger name

    • severity: "error" | "info" | "verbose" | "warning"
    • message: string | Error

      log message format

    • args: readonly Object[]

      message arguments

    • hints: {
          color?: string;
      }

      optional formatting hints

      • Optional color?: string

        Optional preferred logger color.

    Returns void

Generated using TypeDoc