DevTools: named loggers in console API |
|||||||||
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');
,
Jun 2 2017
,
Jun 2 2017
,
Jun 13 2017
,
Jun 13 2017
,
Jun 16 2017
How do you filter for messages from this named logger in the Console?
,
Jun 16 2017
We haven't implemented front-end side yet. So I reopened it for now since AFAIK we don't have another issue for filtering.
,
Jun 20 2017
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
,
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')`?
,
Jun 29 2017
> 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. ;)
,
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
,
Nov 8 2017
Marking as fixed since there is no currently planned work for named loggers at this time. |
|||||||||
►
Sign in to add a comment |
|||||||||
Comment 1 Deleted