Commit f5ec5fd5 authored by Kyle Horimoto's avatar Kyle Horimoto Committed by Commit Bot

[CrOS MultiDevice] Fix a few chrome://multidevice-internals issues

(1) Add a newline at the end of each line when saving logs file.
(2) Show logs in chronological order.
(3) Fix issue which showed "../../" at the start of every filename.

Change-Id: I3c40a4c083d156c70998149a0c61b618767c7fc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2372600
Auto-Submit: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Josh Nohle <nohle@chromium.org>
Reviewed-by: default avatarJosh Nohle <nohle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#801383}
parent 4562b3f8
......@@ -39,6 +39,6 @@
<div id="item-metadata">
<span>[[item.time]]</span>
<div id="flex"></div>
<span>[[item.file]]:[[item.line]]</span>
<span>[[getFilenameWithLine_(item.file, item.line)]]</span>
</div>
</div>
......@@ -42,4 +42,18 @@ Polymer({
break;
}
},
/**
* @return {string}
* @private
*/
getFilenameWithLine_() {
if (!this.item) {
return '';
}
// The filename is prefixed with "../../", so replace it with "//".
let filename = this.item.file.replace('../../', '//');
return filename + ':' + this.item.line;
},
});
......@@ -39,7 +39,7 @@ function logToSavedString_(log) {
// Reduce the file path to just the file name for logging simplification.
const file = log.file.substring(log.file.lastIndexOf('/') + 1);
return `[${log.time} ${severity} ${file} (${log.line})] ${log.text}`;
return `[${log.time} ${severity} ${file} (${log.line})] ${log.text}\n`;
}
Polymer({
......@@ -124,7 +124,9 @@ Polymer({
* @return {!Array<string>}
*/
getSerializedLogStrings_() {
return this.logList_.map(logToSavedString_);
// Reverse the logs so that the oldest logs appear first and the newest logs
// appear last.
return this.logList_.map(logToSavedString_).reverse();
},
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment