New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 728767 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Nov 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 3
Type: Bug

Blocked on:
issue 732717



Sign in to add a comment

DevTools: named loggers in console API

Project Member Reported by pfeldman@chromium.org, Jun 1 2017

Issue description

Filtering third party messages from console comes up more and more often. Let's introduce a new console command that would return a named logger that has API matching the one for console. We'll support it in DevTools with the filtering capabilities.

const logger = console.context ? console.context('name') : console;
logger.debug('Hello world');
logger.info('Hello world');
logger.warn('Hello world');
logger.error('Hello world');

 

Comment 1 Deleted

Description: Show this description
Description: Show this description
Blockedon: 732717
Status: Fixed (was: Assigned)

Comment 6 by kayce@google.com, Jun 16 2017

Labels: DevTools-Release-Notes-Feature
How do you filter for messages from this named logger in the Console?
Status: Assigned (was: Fixed)
We haven't implemented front-end side yet. So I reopened it for now since AFAIK we don't have another issue for filtering.
Cc: kozyatinskiy@chromium.org
Owner: l...@chromium.org
Erik, please take a look!

Console message context added to protocol as argument of consoleAPICalled notification and available in ToT Chromium: 
https://chromium.googlesource.com/v8/v8.git/+/701d79d08ad4cb8fb6c61d49a5fb2a4862f29d9e%5E%21/src/inspector/js_protocol.json

Comment 9 by l...@chromium.org, Jun 29 2017

I will take a look!  This could have neat use cases for library devs.

Is there anything we can do about tying the context name to messages that don't come from console API?  e.g. actual thrown errors, violations/deprecations, network 404 messages?

Some libraries intentionally throw a new Error with a custom message.  Should we consider `throw new Error('useful trace or message', 'myContext1')`?
> Is there anything we can do about tying the context name to messages that don't come from console API?

Interesting idea. I think we can probably wait for some adoption here before we invest into this side of things. We got some work to do to satisfy the epic console filter crowd. ;)
Project Member

Comment 11 by bugdroid1@chromium.org, Aug 8 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/17cf8f4795c83934eace66202c81cfe3940a8222

commit 17cf8f4795c83934eace66202c81cfe3940a8222
Author: Erik Luo <luoe@chromium.org>
Date: Tue Aug 08 02:41:34 2017

DevTools: introduce experiment iterating on log management UI

Adds the 'context' property to console messages and allows for their
filtering via a sidebar when 'Log management' is enabled.

Screenshot: http://imgur.com/a/H4DPc

Bug:  728767 
Change-Id: I2fea8cfa90cde92f06fb57551a00c763878feb0d
Reviewed-on: https://chromium-review.googlesource.com/595202
Commit-Queue: Erik Luo <luoe@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#492511}
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/LayoutTests/inspector/console/console-filter-test-expected.txt
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/LayoutTests/inspector/console/console-filter-test.html
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/BUILD.gn
[add] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/console/ConsoleSidebar.js
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/console/ConsoleView.js
[add] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/console/consoleSidebar.css
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/console/module.json
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/console_model/ConsoleModel.js
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/main/Main.js
[modify] https://crrev.com/17cf8f4795c83934eace66202c81cfe3940a8222/third_party/WebKit/Source/devtools/front_end/sdk/RuntimeModel.js

Comment 12 by l...@chromium.org, Nov 8 2017

Status: Fixed (was: Assigned)
Marking as fixed since there is no currently planned work for named loggers at this time.

Sign in to add a comment