-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Nearby] Send log from NS_LOG macro to chrome://nearby-internals.
Allows logging messages of NS_LOG to be displayed in the logging tab of the internal debug page, with functionality to clear the log buffer and save the logs that appear on the page. See screenshot here of how logs will appear on the page: https://screenshot.googleplex.com/F2HptWvSd0z . Bug: 1093634 Change-Id: I52b98f007be558e69cec3096681c9c3cff9a3609 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2241338 Commit-Queue: Juliet Levesque <julietlevesque@google.com> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Reviewed-by: Josh Nohle <nohle@chromium.org> Cr-Commit-Position: refs/heads/master@{#785538}
- Loading branch information
1 parent
801a509
commit 80ab977
Showing
18 changed files
with
538 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
module.exports = { | ||
'env': { | ||
'browser': true, | ||
'es6': true, | ||
}, | ||
'rules': {'eqeqeq': ['error', 'always', {'null': 'ignore'}]}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<style> | ||
:host { | ||
--large-font-size: 120%; | ||
} | ||
|
||
.warning-log { | ||
background-color: rgb(255, 252, 239); | ||
color: rgb(49, 34, 0); | ||
font-size: var(--large-font-size); | ||
} | ||
|
||
.error-log { | ||
background-color: rgb(255, 241, 241); | ||
color: rgb(239, 0, 0); | ||
font-size: var(--large-font-size); | ||
} | ||
|
||
#item-metadata { | ||
color: #888; | ||
display: flex; | ||
font-size: 10px; | ||
margin-bottom: 4px; | ||
padding: 6px; | ||
} | ||
|
||
#flex { | ||
flex: 1; | ||
} | ||
|
||
#text { | ||
display: inline-block; | ||
margin: 3px; | ||
padding: 5px; | ||
text-align: left; | ||
width: 100%; | ||
} | ||
</style> | ||
<div id="item" severity="[[item.severity]]"> | ||
<p id="text">[[item.text]]</p> | ||
<div id="item-metadata"> | ||
<span>[[item.time]]</span> | ||
<div id="flex"></div> | ||
<span>[[item.file]]:[[item.line]]</span> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2020 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
import {html, Polymer} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; | ||
import {Severity} from './types.js'; | ||
|
||
Polymer({ | ||
is: 'log-object', | ||
|
||
_template: html`{__html_template__}`, | ||
|
||
properties: { | ||
/** | ||
* Underlying LogMessage data for this item. Contains read-only fields | ||
* from the NearbyShare backend, as well as fields computed by logging tab. | ||
* Type: {!LogMessage} | ||
*/ | ||
item: { | ||
type: Object, | ||
observer: 'itemChanged_', | ||
}, | ||
}, | ||
|
||
/** | ||
* Sets the log message style based on severity level. | ||
* @private | ||
*/ | ||
itemChanged_() { | ||
switch (this.item.severity) { | ||
case Severity.WARNING: | ||
this.$['item'].classList.add('warning-log'); | ||
break; | ||
case Severity.ERROR: | ||
this.$['item'].classList.add('error-log'); | ||
break; | ||
default: | ||
break; | ||
} | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,35 @@ | ||
<h1>Logs page coming soon.</h1> | ||
<style include="shared-style"> | ||
:host { | ||
--standard-border: 1px solid black; | ||
} | ||
|
||
#logs-list { | ||
display: flex; | ||
flex-direction: column; | ||
height: 100%; | ||
} | ||
|
||
log-object { | ||
border-top: var(--standard-border); | ||
border-right: var(--standard-border); | ||
border-left: var(--standard-border); | ||
} | ||
|
||
log-object:last-child { | ||
border-bottom: var(--standard-border); | ||
} | ||
</style> | ||
<cr-button disabled="[[!logList_.length]]" class="internals-button" | ||
on-click="onSaveLogsButtonClicked_"> | ||
Save Logs | ||
</cr-button> | ||
<cr-button disabled="[[!logList_.length]]" class="internals-button" | ||
on-click="onClearLogsButtonClicked_"> | ||
Clear Logs | ||
</cr-button> | ||
<iron-list items="[[logList_]]" as="log" id="logs-list"> | ||
<template> | ||
<log-object item="[[log]]"> | ||
</log-object> | ||
</template> | ||
</iron-list> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.