Skip to content

Commit

Permalink
Replace intel with sitespeed.io/log
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Jan 6, 2025
1 parent 039da57 commit b5dbdbf
Show file tree
Hide file tree
Showing 84 changed files with 207 additions and 413 deletions.
5 changes: 3 additions & 2 deletions bin/browsertime.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import merge from 'lodash.merge';
import get from 'lodash.get';
import set from 'lodash.set';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { existsSync, mkdirSync } from 'node:fs';
import path from 'node:path';
import { Engine } from '../lib/core/engine/index.js';
Expand All @@ -17,7 +17,7 @@ import { StorageManager } from '../lib/support/storageManager.js';
import { loadScript } from '../lib/support/engineUtils.js';
import { isAndroidConfigured } from '../lib/android/index.js';

const log = intel.getLogger('browsertime');
const log = getLogger('browsertime');
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
const delay = ms => new Promise(response => setTimeout(response, ms));

Expand Down Expand Up @@ -193,6 +193,7 @@ async function run(urls, options) {
}
} catch (error) {
log.error('Error running browsertime', error);
console.log(error);
process.exitCode = 1;
} finally {
process.exit();
Expand Down
4 changes: 2 additions & 2 deletions lib/android/gnirehtet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { execa } from 'execa';
import intel from 'intel';
const log = intel.getLogger('browsertime.gnirehtet');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.gnirehtet');
const delay = ms => new Promise(response => setTimeout(response, ms));

export class Gnirehtet {
Expand Down
4 changes: 2 additions & 2 deletions lib/android/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { mkdir as _mkdir, createWriteStream } from 'node:fs';
import path from 'node:path';
import { EOL as endOfLine } from 'node:os';
import { execa } from 'execa';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import pkg from '@devicefarmer/adbkit';
import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js';
const { Adb } = pkg;
import get from 'lodash.get';
import { pathToFolder } from '../support/pathToFolder.js';
const log = intel.getLogger('browsertime.android');
const log = getLogger('browsertime.android');
const mkdir = promisify(_mkdir);
const delay = ms => new Promise(res => setTimeout(res, ms));

Expand Down
4 changes: 2 additions & 2 deletions lib/android/root.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.android');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.android');

// Adopted from
// https://dxr.mozilla.org/mozilla-central/source/testing/raptor/raptor/performance_tuning.py
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/chromeDevtoolsProtocol.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import CDP from 'chrome-remote-interface';
const log = intel.getLogger('browsertime.chrome.cdp');
const log = getLogger('browsertime.chrome.cdp');
import { toArray } from '../support/util.js';
import { traceCategories as defaultTraceCategories } from './settings/traceCategories.js';

Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/har.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { harFromMessages } from 'chrome-har';
import { logging } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.chrome');
const log = getLogger('browsertime.chrome');
import { addBrowser } from '../support/har/index.js';
const { Type } = logging;

Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/networkManager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import get from 'lodash.get';

const log = intel.getLogger('browsertime.chrome.network');
const log = getLogger('browsertime.chrome.network');

export class NetworkManager {
constructor(cdpClient, options) {
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/parseCpuTrace.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { computeMainThreadTasks } from '@sitespeed.io/tracium';
const log = intel.getLogger('browsertime.chrome.cpu');
const log = getLogger('browsertime.chrome.cpu');

function round(number_, decimals = 3) {
const pow = Math.pow(10, decimals);
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/traceCategoriesParser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.chrome.trace');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.chrome.trace');

// Adopting the Lighthouse way to clean the Trace log
// https://github.com/GoogleChrome/lighthouse/blob/50a68ab2bf0115427e767e5e40dfe6be671902fe/lighthouse-core/config/config.js#L29-L110
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/webdriver/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { promisify } from 'node:util';
import { unlink as _unlink, rm as _rm } from 'node:fs';
import path from 'node:path';
import { logging } from 'selenium-webdriver';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import usbPowerProfiler from 'usb-power-profiling/usb-power-profiling.js';
const log = intel.getLogger('browsertime.chrome');
const log = getLogger('browsertime.chrome');
const { Type } = logging;
import { longTaskMetrics } from '../longTaskMetrics.js';
import { parseCPUTrace } from '../parseCpuTrace.js';
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/webdriver/setupChromiumOptions.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { readFileSync } from 'node:fs';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { chromeDesktopOptions as defaultChromeOptions } from '../settings/chromeDesktopOptions.js';
import { chromeAndroidOptions as defaultAndroidChromeOptions } from '../settings/chromeAndroidOptions.js';
import { getViewPort } from '../../support/getViewPort.js';
import { toArray } from '../../support/util.js';
import { isAndroidConfigured } from '../../android/index.js';
const log = intel.getLogger('browsertime.chrome');
const log = getLogger('browsertime.chrome');

const CHROME_AMD_EDGE_INTERNAL_PHONE_HOME = [
'MAP cache.pack.google.com 127.0.0.1',
Expand Down
4 changes: 2 additions & 2 deletions lib/chrome/webdriver/traceUtilities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.chrome');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.chrome');

function getLargestContentfulPaintEvent(traceEvents) {
const lcpCandidates = traceEvents.filter(
Expand Down
4 changes: 2 additions & 2 deletions lib/connectivity/humble.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import http from 'node:http';
import https from 'node:https';
import get from 'lodash.get';
import intel from 'intel';
const log = intel.getLogger('browsertime.connectivity.humble');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.connectivity.humble');

export class Humble {
constructor(options) {
Expand Down
4 changes: 2 additions & 2 deletions lib/connectivity/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import get from 'lodash.get';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import {
start as throttleStart,
stop as throttleStop
} from '@sitespeed.io/throttle';
const log = intel.getLogger('browsertime.connectivity');
const log = getLogger('browsertime.connectivity');
import { Humble } from './humble.js';
import { parseTrafficShapeConfig } from './trafficShapeParser.js';

Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/collector.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import path from 'node:path';
import { createRequire } from 'node:module';
import get from 'lodash.get';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { timestamp as _timestamp } from '../../support/engineUtils.js';
import { Statistics } from '../../support/statistics.js';
import { pathToFolder } from '../../support/pathToFolder.js';
import { getConnectivitySettings } from '../../connectivity/index.js';
import { formatMetric } from '../../support/util.js';
const require = createRequire(import.meta.url);
const version = require('../../../package.json').version;
const log = intel.getLogger('browsertime');
const log = getLogger('browsertime');

function getNewResult(url, options) {
return {
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/addText.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { By } from 'selenium-webdriver';
import intel from 'intel';
const log = intel.getLogger('browsertime.command.addText');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.addText');

/**
* Provides functionality to add text to elements on a web page using various selectors.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/android.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { Android, isAndroidConfigured } from '../../../android/index.js';
const log = intel.getLogger('browsertime.command.android');
const log = getLogger('browsertime.command.android');
/**
* Provides functionality to interact with an Android device through shell commands.
* @class
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/bidi.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.bidi');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.bidi');

/**
* Manages interactions using Bidi. At the moment this only works for Firefox
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/cache.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.cache');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.cache');
/**
* Manage the browser cache.
* This class provides methods to clear the cache and cookies in different browsers.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/chromeDevToolsProtocol.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.devtoolsprotocol');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.devtoolsprotocol');

/**
* Manages interactions with the Chrome DevTools Protocol for Chrome and Edge browsers.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/chromeTrace.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';

import { getRenderBlocking } from '../../../chrome/webdriver/traceUtilities.js';
import { parse } from '../../../chrome/traceCategoriesParser.js';
import { parseCPUTrace } from '../../../chrome/parseCpuTrace.js';
const log = intel.getLogger('browsertime.command.chrometrace');
const log = getLogger('browsertime.command.chrometrace');
/**
* Manages Chrome trace functionality, enabling custom profiling and trace collection in Chrome.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/click.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.click');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.click');

function addClick(js) {
const trimmed = js.trim();
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/debug.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.debug');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.debug');
const delay = ms => new Promise(res => setTimeout(res, ms));

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/geckoProfiler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.geckoprofiler');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.geckoprofiler');
/**
* Manages the Gecko Profiler for profiling Firefox performance.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/javaScript.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.javascript');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.javascript');
/**
* Provides functionality to execute JavaScript code in the context of the current page.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/measure.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import path from 'node:path';
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import get from 'lodash.get';
import merge from 'lodash.merge';
import { timestamp as _timestamp } from '../../../support/engineUtils.js';
Expand All @@ -15,7 +15,7 @@ import { TCPDump } from '../../../support/tcpdump.js';
import { lcpHighlightScript as highlightLargestContentfulPaint } from './util/lcpHighlightScript.js';
import { clsHighlightScript as highlightLS } from './util/lsHighlightScript.js';
const delay = ms => new Promise(res => setTimeout(res, ms));
const log = intel.getLogger('browsertime.command.measure');
const log = getLogger('browsertime.command.measure');

// In some cases we could have one alias mapped to multiple URLs
// we've seen it for login etc where the user get different query parameter
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/mouse/clickAndHold.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By, Origin } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.mouse');
const log = getLogger('browsertime.command.mouse');

/**
* Provides functionality to click and hold elements on a web page using different strategies.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/mouse/contextClick.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.mouse');
const log = getLogger('browsertime.command.mouse');

/**
* Provides functionality to perform a context click (right-click) on elements in a web page.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/mouse/doubleClick.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.mouse');
const log = getLogger('browsertime.command.mouse');
/**
* Provides functionality to perform a double-click action on elements in a web page.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/mouse/mouseMove.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By, Origin } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.mouse');
const log = getLogger('browsertime.command.mouse');
/**
* Provides functionality to move the mouse cursor to elements or specific positions on a web page.
*
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/mouse/singleClick.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.mouse');
const log = getLogger('browsertime.command.mouse');

/**
* Provides functionality to perform a single click action on elements or at specific positions in a web page. Uses Seleniums Action API.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/navigation.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.navigation');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.navigation');

/**
* Provides functionality to control browser navigation such as back, forward, and refresh actions.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/screenshot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.screenshot');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.screenshot');

/**
* Take a screenshot. The screenshot will be stored to disk,
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/scroll.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.scroll');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.scroll');
const delay = ms => new Promise(res => setTimeout(res, ms));

/**
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/select.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.select');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.select');

/**
* Provides functionality to interact with `<select>` elements on a web page.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/set.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import intel from 'intel';
const log = intel.getLogger('browsertime.command.set');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.set');

/**
* Provides functionality to set properties like innerHTML, innerText, and value on elements in a web page.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/stopWatch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { performance } from 'node:perf_hooks';
import intel from 'intel';
const log = intel.getLogger('browsertime.command.stopwatch');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.stopwatch');

/**
* A stopwatch utility for measuring time intervals.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/switch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import intel from 'intel';
import { getLogger } from '@sitespeed.io/log';
import { By } from 'selenium-webdriver';
const log = intel.getLogger('browsertime.command.switch');
const log = getLogger('browsertime.command.switch');

/**
* Provides functionality to switch between frames, windows, and tabs in the browser.
Expand Down
4 changes: 2 additions & 2 deletions lib/core/engine/command/wait.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import webdriver from 'selenium-webdriver';
import intel from 'intel';
const log = intel.getLogger('browsertime.command.wait');
import { getLogger } from '@sitespeed.io/log';
const log = getLogger('browsertime.command.wait');
const delay = ms => new Promise(res => setTimeout(res, ms));

/**
Expand Down
Loading

0 comments on commit b5dbdbf

Please sign in to comment.