Use more descriptive name for making log prefixes

Signed-off-by: Thomas Scholtes <geigerzaehler@axiom.fm>
This commit is contained in:
Thomas Scholtes
2023-11-23 09:37:13 +01:00
committed by Rūdolfs Ošiņš
parent 5d4511e3a7
commit de64d7c151
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -9,7 +9,7 @@ import { test as base, expect, type ViewportSize } from "@playwright/test";
import * as Process from "./process.js";
import * as issue from "@tests/support/cobs/issue.js";
import * as logLabel from "@tests/support/logLabel.js";
import * as logLabel from "@tests/support/logPrefix.js";
import * as patch from "@tests/support/cobs/patch.js";
import { createOptions, supportDir, tmpDir } from "@tests/support/support.js";
import { createPeerManager } from "@tests/support/peerManager.js";
@@ -52,7 +52,7 @@ export const test = base.extend<{
forAllTests: [
async ({ customAppConfig, outputLog, page }, use) => {
const browserLabel = logLabel.make("browser");
const browserLabel = logLabel.logPrefix("browser");
page.on("console", msg => {
// Ignore common console logs that we don't care about.
if (
@@ -111,7 +111,7 @@ export const test = base.extend<{
});
}
const playwrightLabel = logLabel.make("playwright");
const playwrightLabel = logLabel.logPrefix("playwright");
function isLocalhost(url: URL) {
return url.hostname === "localhost" || url.hostname === "127.0.0.1";
@@ -23,7 +23,7 @@ const availableColors: ColorName[] = [
const assignedColors: Record<string, ColorName> = {};
export function make(label: string): string {
export function logPrefix(label: string): string {
if (assignedColors[label] === undefined) {
const color = availableColors.pop();
if (!color) {
+2 -2
View File
@@ -5,7 +5,7 @@ import onExit from "exit-hook";
import { StringDecoder } from "string_decoder";
import { execa } from "execa";
import { make } from "./logLabel.js";
import { logPrefix } from "./logPrefix.js";
// Processes that should be SIGKILLed when the Node process shutsdown.
// We add all proxy and node instances that we spawn to this list.
@@ -42,7 +42,7 @@ export function prefixOutput(
label: string,
output: Stream.Writable,
): ExecaChildProcess {
const pref = make(label);
const pref = logPrefix(label);
if (childProcess.stdout) {
const stdoutPrefix = new LinePrefix(pref);
childProcess.stdout.pipe(stdoutPrefix).pipe(output, { end: false });