Packager: Shorter + Consistent-Width Timestamps

Summary: Sets some options on `toLocaleString()` so that the server debug output's timestamps are shorter and have a consistent width (zero-padded).

Reviewed By: cpojer

Differential Revision: D4235074

fbshipit-source-id: 72dcf35ffd182eb70afc20d2b266314787433c4a
This commit is contained in:
Tim Yung 2016-11-28 13:06:28 -08:00 committed by Facebook Github Bot
parent 90197e919b
commit 0b7a6d830f
1 changed files with 11 additions and 1 deletions

View File

@ -23,6 +23,16 @@ import type {
LogEntry,
} from './Types';
const DATE_LOCALE_OPTIONS = {
day: '2-digit',
hour12: false,
hour: '2-digit',
minute: '2-digit',
month: '2-digit',
second: '2-digit',
year: 'numeric',
};
let PRINT_LOG_ENTRIES = true;
const log_session = `${os.hostname()}-${Date.now()}`;
const eventEmitter = new EventEmitter();
@ -95,7 +105,7 @@ function print(
duration_ms: duration,
} = logEntry;
const timeStamp = new Date().toLocaleString();
const timeStamp = new Date().toLocaleString(undefined, DATE_LOCALE_OPTIONS);
let logEntryString;
switch (actionPhase) {