westy92/html-pdf-chrome

Log Handler

lucasbaesso opened this issue · 1 comments

Hello @westy92
Is it possible to add a log handler to the project?
Like this example:

  await Promise.all([
    Network.enable(),
    Page.enable(),
    Runtime.enable(),
    Log.enable()
  ]);
  if (options.clientLogHandler) {
    Log.entryAdded(options.clientLogHandler);
  }

Use case example:

var logHandler = (e) => {
  chromeLogger.debug(e.entry.source + ': ' + e.entry.text);
};

options.clientLogHandler = logHandler;

Chrome DevTools Log reference: https://chromedevtools.github.io/devtools-protocol/tot/Log/

Feel free to submit a pull request!