Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Unified Diff: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 2683713004: DevTools: revert of timestamp format dropdown (Closed)
Patch Set: wrong upstream Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
diff --git a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
index 9cd71c1a252d0acf5710f73d4fa85554de604e64..801c698f80c23770772246a7b59571c4a7947a25 100644
--- a/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
+++ b/third_party/WebKit/Source/devtools/front_end/console/ConsoleViewMessage.js
@@ -834,13 +834,11 @@ Console.ConsoleViewMessage = class {
if (!this._contentElement)
return;
- var format = Common.moduleSetting('consoleTimestampFormat').get();
- if (format !== Console.ConsoleViewMessage.TimestampFormat.None) {
- var timestampText = formatTimestamp(this._message.timestamp, format);
+ if (Common.moduleSetting('consoleTimestampsEnabled').get()) {
if (!this._timestampElement)
this._timestampElement = createElementWithClass('span', 'console-timestamp');
- this._timestampElement.textContent = timestampText + ' ';
- this._timestampElement.title = timestampText;
+ this._timestampElement.textContent = formatTimestamp(this._message.timestamp, false) + ' ';
+ this._timestampElement.title = formatTimestamp(this._message.timestamp, true);
this._contentElement.insertBefore(this._timestampElement, this._contentElement.firstChild);
} else if (this._timestampElement) {
this._timestampElement.remove();
@@ -849,17 +847,15 @@ Console.ConsoleViewMessage = class {
/**
* @param {number} timestamp
- * @param {!Console.ConsoleViewMessage.TimestampFormat} format
+ * @param {boolean} full
* @return {string}
*/
- function formatTimestamp(timestamp, format) {
+ function formatTimestamp(timestamp, full) {
var date = new Date(timestamp);
var yymmdd = date.getFullYear() + '-' + leadZero(date.getMonth() + 1, 2) + '-' + leadZero(date.getDate(), 2);
var hhmmssfff = leadZero(date.getHours(), 2) + ':' + leadZero(date.getMinutes(), 2) + ':' +
leadZero(date.getSeconds(), 2) + '.' + leadZero(date.getMilliseconds(), 3);
- if (format === Console.ConsoleViewMessage.TimestampFormat.Full)
- return yymmdd + ' ' + hhmmssfff;
- return hhmmssfff;
+ return full ? (yymmdd + ' ' + hhmmssfff) : hhmmssfff;
/**
* @param {number} value
@@ -1212,15 +1208,6 @@ Console.ConsoleViewMessage = class {
};
/**
- * @enum {string}
- */
-Console.ConsoleViewMessage.TimestampFormat = {
- None: 'none',
- Full: 'full',
- Short: 'short'
-};
-
-/**
* @unrestricted
*/
Console.ConsoleGroupViewMessage = class extends Console.ConsoleViewMessage {

Powered by Google App Engine
This is Rietveld 408576698