Skip to content

fix(lighthouse): hide logs timestamp when running in tty #50

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 13, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/lighthouse.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// prevent logger from prefixing a date when running in tty
process.env.DEBUG_COLORS = 'true';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that process.env.VAR = '...' sets the environment variable in the next plugins and/or build.command as well.
I am guessing this might not be intended. This could be fixed by restoring the previous value of this environment variable right after it's been used.
@erezrokah

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I'll change it


const puppeteer = require('puppeteer');
const lighthouse = require('lighthouse');
const log = require('lighthouse-logger');
Expand All @@ -16,8 +19,6 @@ const getBrowserPath = async () => {
const runLighthouse = async (browserPath, url) => {
let chrome;
try {
// prevent logger from prefixing a date when running in tty
require('debug').inspectOpts.colors = true;
const logLevel = 'info';
log.setLevel(logLevel);
chrome = await chromeLauncher.launch({
Expand Down