From 0922a49190f364372803823a8a59986d612f52c1 Mon Sep 17 00:00:00 2001 From: Peter Hedenskog Date: Mon, 3 Mar 2025 18:54:58 +0100 Subject: [PATCH] Add support to manually set the log level. (#2264) https://github.com/sitespeedio/sitespeed.io/issues/4456 --- lib/support/cli.js | 5 +++++ lib/support/logging.js | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/support/cli.js b/lib/support/cli.js index 1ce4388fa..c18a7c39b 100644 --- a/lib/support/cli.js +++ b/lib/support/cli.js @@ -1184,6 +1184,11 @@ export function parseCommandLine() { describe: 'Append a String to the user agent. Works in Chrome/Edge and Firefox.' }) + .option('logLevel', { + type: 'string', + choices: ['trace', 'verbose', 'debug', 'info', 'warning', 'error'], + describe: 'Manually set the min log level' + }) .option('silent', { alias: 'q', type: 'count', diff --git a/lib/support/logging.js b/lib/support/logging.js index 671f0a446..c143411d0 100644 --- a/lib/support/logging.js +++ b/lib/support/logging.js @@ -10,6 +10,7 @@ import { configureLog } from '@sitespeed.io/log'; */ export function configure(options = {}) { configureLog({ + level: options.logLevel ?? undefined, verbose: options.verbose ?? 0, silent: options.silent ?? false });