Skip to content

Commit

Permalink
Update logging
Browse files Browse the repository at this point in the history
  • Loading branch information
estherkim committed Feb 14, 2019
1 parent 7e4f701 commit d69c38a
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion build-system/pr-check/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const {getStderr} = require('../exec');
const FILENAME = 'build.js';
const FILELOGPREFIX = colors.bold(colors.yellow(`${FILENAME}:`));
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

/**
* Prints a summary of files changed by, and commits included in the PR.
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/checks.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'checks.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function main() {
const startTime = startTimer(FILENAME);
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/dist-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'dist-test.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function runSinglePassTest_() {
timedExecOrDie('rm -R dist');
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/local-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'local-test.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function main() {
const startTime = startTimer(FILENAME);
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/remote-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'remote-test.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function main() {
const startTime = startTimer(FILENAME);
Expand Down
13 changes: 7 additions & 6 deletions build-system/pr-check/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ function stopSauceConnect(functionName) {
/**
* Starts a timer to measure the execution time of the given function.
* @param {string} functionName
* @param {string} fileName
* @return {DOMHighResTimeStamp}
*/
function startTimer(functionName) {
function startTimer(functionName, fileName) {
const startTime = Date.now();
const fileLogPrefix = colors.bold(colors.yellow(`${functionName}:`));
const fileLogPrefix = colors.bold(colors.yellow(`${fileName}:`));
console.log(
'\n' + fileLogPrefix, 'Running', colors.cyan(functionName) + '...');
return startTime;
Expand Down Expand Up @@ -95,12 +96,12 @@ function timedExec(cmd) {
* Executes the provided command and times it. The program terminates in case of
* failure.
* @param {string} cmd
* @param {string} functionName
* @param {string} fileName
*/
function timedExecOrDie(cmd, functionName = 'utils.js') {
const startTime = startTimer(functionName);
function timedExecOrDie(cmd, fileName = 'utils.js') {
const startTime = startTimer(cmd, fileName);
execOrDie(cmd);
stopTimer(functionName, startTime);
stopTimer(fileName, startTime);
}


Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'validator.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function main() {
const startTime = startTimer(FILENAME);
Expand Down
2 changes: 1 addition & 1 deletion build-system/pr-check/visual-diff-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {isTravisPushBuild} = require('../travis');

const FILENAME = 'visual-diff-test.js';
const timedExecOrDie =
(cmd, unusedFunctionName) => timedExecOrDieBase(cmd, FILENAME);
(cmd, unusedFileName) => timedExecOrDieBase(cmd, FILENAME);

function main() {
const startTime = startTimer(FILENAME);
Expand Down

0 comments on commit d69c38a

Please sign in to comment.