From 0b7a6d830f16684bf3d87a58491a31c719e1f2ab Mon Sep 17 00:00:00 2001 From: Tim Yung Date: Mon, 28 Nov 2016 13:06:28 -0800 Subject: [PATCH] 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 --- react-packager/src/Logger/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/react-packager/src/Logger/index.js b/react-packager/src/Logger/index.js index 11bf72f4..84fe13b6 100644 --- a/react-packager/src/Logger/index.js +++ b/react-packager/src/Logger/index.js @@ -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) {