Add support for --logLevel (#4459)

This commit is contained in:
Peter Hedenskog 2025-03-03 20:28:34 +01:00 committed by GitHub
parent 4e376b9798
commit 28093a4268
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 16 additions and 7 deletions

View File

@ -1978,6 +1978,11 @@ export async function parseCommandLine() {
.option('name', {
describe: 'Give your test a name.'
})
.option('logLevel', {
type: 'string',
choices: ['trace', 'verbose', 'debug', 'info', 'warning', 'error'],
describe: 'Manually set the min log level'
})
.option('open', {
alias: ['o', 'view'],
describe:

View File

@ -2,6 +2,7 @@ import { configureLog } from '@sitespeed.io/log';
export function configure(options = {}) {
configureLog({
level: options.logLevel ?? undefined,
verbose: options.verbose ?? 0,
silent: options.silent ?? false
});

View File

@ -3,6 +3,8 @@ import { parse } from 'node:url';
import { default as _merge } from 'lodash.merge';
import { getLogger } from '@sitespeed.io/log';
import { configureLogging } from 'browsertime';
const log = getLogger('plugin.browsertime');
import dayjs from 'dayjs';
@ -88,10 +90,10 @@ export default class BrowsertimePlugin extends SitespeedioPlugin {
'browsertime.run'
);
this.axeAggregatorTotal = new AxeAggregator(this.options);
configureLogging(options);
}
async processMessage(message) {
const { configureLogging } = await import('browsertime');
configureLogging(this.options);
const options = this.options;
switch (message.type) {
// When sistespeed.io starts, a setup messages is posted on the queue

9
npm-shrinkwrap.json generated
View File

@ -17,7 +17,7 @@
"@slack/webhook": "7.0.4",
"@tgwf/co2": "0.16.4",
"axe-core": "4.10.2",
"browsertime": "24.2.0",
"browsertime": "24.3.0",
"coach-core": "8.1.1",
"dayjs": "1.11.11",
"fast-crc32c": "2.0.0",
@ -3231,9 +3231,10 @@
}
},
"node_modules/browsertime": {
"version": "24.2.0",
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-24.2.0.tgz",
"integrity": "sha512-qC4sLm1tf18xdc5Hirpd6RRd4mz8T2dv+/7iImHG3U6BC8GoIio0picEBbtdB8dFXp0VgCBQwg1nFeSIf/HXBA==",
"version": "24.3.0",
"resolved": "https://registry.npmjs.org/browsertime/-/browsertime-24.3.0.tgz",
"integrity": "sha512-wT4AuqwyHAwxn5L+rke8qtBHDOxg6KgdRPJFxsEYETZqLC3zv9xNDYWpMhfhS6sWkUMw7w/iRbx7wdzfZLvIeg==",
"license": "MIT",
"dependencies": {
"@devicefarmer/adbkit": "3.3.8",
"@sitespeed.io/chromedriver": "133.0.6943-53",

View File

@ -88,7 +88,7 @@
"@tgwf/co2": "0.16.4",
"@slack/webhook": "7.0.4",
"axe-core": "4.10.2",
"browsertime": "24.2.0",
"browsertime": "24.3.0",
"coach-core": "8.1.1",
"dayjs": "1.11.11",
"fast-crc32c": "2.0.0",