Skip to content

Commit 6cf93f8

Browse files
committed
make logging more palletable
1 parent 97e75ba commit 6cf93f8

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

packages/firestore/scripts/run-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function errorLog(...args: any[]): void {
8282
console.error(__filename, elapsedTimeStr(), ...args);
8383
}
8484

85-
debugLog('command-line arguments:', process.argv);
85+
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
8686

8787
const argv = yargs.options({
8888
main: {
@@ -134,7 +134,7 @@ if (argv.persistence) {
134134

135135
args = args.concat(argv._ as string[]);
136136

137-
debugLog("spawning child process:", nyc, args);
137+
debugLog(`spawning child process: ${nyc} ${args.join(' ')}`);
138138

139139
const childProcess = spawn(nyc, args, {
140140
stdio: 'inherit',

scripts/ci-test/test_changed.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function elapsedTimeStr(): string {
5454
let elapsedMillisecondsStartTime: number | null = null;
5555

5656
/**
57-
* Returns the number of nanoseconds that have elapsed since this function's
57+
* Returns the number of milliseconds that have elapsed since this function's
5858
* first invocation. Returns 0 on its first invocation.
5959
*/
6060
function getElapsedMilliseconds(): number {
@@ -84,7 +84,7 @@ function errorLog(...args: any[]): void {
8484
console.error(__filename, elapsedTimeStr(), ...args);
8585
}
8686

87-
debugLog('command-line arguments:', process.argv);
87+
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
8888

8989
const argv = yargs.parseSync();
9090
const inputTestConfigName = argv._[0].toString();
@@ -139,9 +139,9 @@ async function runTests(config: TestConfig) {
139139
}
140140

141141
lernaCmd.push(testCommand);
142-
debugLog('spawning process: npx', lernaCmd);
142+
debugLog(`spawning process: npx ${lernaCmd.join(' ')}`);
143143
await spawn('npx', lernaCmd, { stdio: 'inherit', cwd: root });
144-
debugLog('process completed successfully: npx', lernaCmd);
144+
debugLog(`process completed successfully: npx ${lernaCmd.join(' ')}`);
145145
process.exit(0);
146146
} catch (e) {
147147
errorLog('process failed');

scripts/run_tests_in_ci.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function errorLog(...args) {
8181
console.error(__filename, elapsedTimeStr(), ...args);
8282
}
8383

84-
debugLog('command-line arguments:', process.argv);
84+
debugLog(`command-line arguments: ${process.argv.join(' ')}`);
8585

8686
const LOGDIR = process.env.CI ? process.env.HOME : '/tmp';
8787
// Maps the packages where we should not run `test:all` and instead isolate the cross-browser tests.
@@ -134,7 +134,7 @@ const argv = yargs.options({
134134
}
135135

136136
const yarnArgs = ['--cwd', dir, scriptName];
137-
debugLog(`spawning '${name}' process:`, 'yarn', yarnArgs);
137+
debugLog(`spawning '${name}' process: yarn ${yarnArgs.join(' ')}`);
138138
const testProcess = spawn('yarn', yarnArgs);
139139

140140
testProcess.childProcess.stdout.on('data', data => {
@@ -145,18 +145,20 @@ const argv = yargs.options({
145145
});
146146

147147
await testProcess;
148-
debugLog(`${name} process completed successfully:`, 'yarn', yarnArgs);
148+
debugLog(
149+
`'${name}' process completed successfully: yarn ${yarnArgs.join(' ')}`
150+
);
149151
writeLogs('Success', name, stdout + '\n' + stderr);
150152
} catch (e) {
151153
errorLog(`${name} process FAILED`);
152-
debugLog(`${name} process ==== STDOUT BEGIN ====`);
154+
errorLog(`${name} process ==== STDOUT BEGIN ====`);
153155
console.log(stdout);
154-
debugLog(`${name} process ==== STDOUT END ====`);
155-
debugLog(`${name} process ==== STDERR BEGIN ====`);
156+
errorLog(`${name} process ==== STDOUT END ====`);
157+
errorLog(`${name} process ==== STDERR BEGIN ====`);
156158
console.error(stderr);
157-
debugLog(`${name} process ==== STDERR END ====`);
159+
errorLog(`${name} process ==== STDERR END ====`);
158160
writeLogs('Failure', name, stdout + '\n' + stderr);
159-
debugLog('Completing with failure exit code 76');
161+
errorLog('Completing with failure exit code 76');
160162
process.exit(76);
161163
}
162164
})();

0 commit comments

Comments
 (0)