From 3ba17a12e59e8992861728e78a795ee3d520fd86 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Wed, 8 Jun 2022 12:28:08 -0700 Subject: [PATCH] core(driver): guard verbose logic behind log.isVerbose check (#14086) --- lighthouse-core/gather/driver/wait-for-condition.js | 3 ++- types/lighthouse-logger/index.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lighthouse-core/gather/driver/wait-for-condition.js b/lighthouse-core/gather/driver/wait-for-condition.js index fa3d069443..66bf517203 100644 --- a/lighthouse-core/gather/driver/wait-for-condition.js +++ b/lighthouse-core/gather/driver/wait-for-condition.js @@ -164,7 +164,8 @@ function waitForNetworkIdle(session, networkMonitor, networkQuietOptions) { const inflightRecords = networkMonitor.getInflightRequests(); // If there are more than 20 inflight requests, load is still in full swing. // Wait until it calms down a bit to be a little less spammy. - if (inflightRecords.length < 20) { + if (log.isVerbose() && inflightRecords.length < 20 && inflightRecords.length > 0) { + log.verbose('waitFor', `=== Waiting on ${inflightRecords.length} requests to finish`); for (const record of inflightRecords) { log.verbose('waitFor', `Waiting on ${record.url.slice(0, 120)} to finish`); } diff --git a/types/lighthouse-logger/index.d.ts b/types/lighthouse-logger/index.d.ts index d7c33a4686..b6da58692e 100644 --- a/types/lighthouse-logger/index.d.ts +++ b/types/lighthouse-logger/index.d.ts @@ -11,6 +11,7 @@ declare module 'lighthouse-logger' { args?: any[]; } export function setLevel(level: string): void; + export function isVerbose(): boolean; export function formatProtocol(prefix: string, data: Object, level?: string): void; export function log(title: string, ...args: any[]): void; export function warn(title: string, ...args: any[]): void;