Skip to content

Commit 9225cdd

Browse files
authored
feat: enable lighthouse logging (#29)
1 parent ad423a3 commit 9225cdd

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/lighthouse.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const puppeteer = require('puppeteer');
22
const lighthouse = require('lighthouse');
3+
const log = require('lighthouse-logger');
34
const chromeLauncher = require('chrome-launcher');
45

56
const getBrowserPath = async () => {
@@ -15,12 +16,16 @@ const getBrowserPath = async () => {
1516
const runLighthouse = async (browserPath, url) => {
1617
let chrome;
1718
try {
19+
const logLevel = 'info';
20+
log.setLevel(logLevel);
1821
chrome = await chromeLauncher.launch({
1922
chromePath: browserPath,
2023
chromeFlags: ['--headless', '--no-sandbox', '--disable-gpu'],
24+
logLevel,
2125
});
2226
const results = await lighthouse(url, {
2327
port: chrome.port,
28+
logLevel,
2429
});
2530
if (results.lhr.runtimeError) {
2631
throw new Error(results.lhr.runtimeError.message);

0 commit comments

Comments
 (0)