How to get console messages generated by chrome?

116 views
Skip to first unread message

Niranjan Rao

unread,
Jul 17, 2023, 1:03:17 PM7/17/23
to chrome-debugging-protocol
Greetings,

I've a custom chromium build. Essentially, I log the messages using following snippet. I do see the messages appearing in console window of the browser however I don't get Runtime.consoleAPICalled events back to me.

context->AddConsoleMessage(MakeGarbageCollected<ConsoleMessage>(
mojom::ConsoleMessageSource::kJavaScript,
mojom::ConsoleMessageLevel::kInfo, msg));

How do I get notifications for messages not originating from Javascript?

Regards,
Niranjan

Ophir Back

unread,
Jul 17, 2023, 1:15:16 PM7/17/23
to chrome-debugging-protocol
Take a look at the Console domain - https://chromedevtools.github.io/devtools-protocol/tot/Console/
After you call `Console.enable()`, you should be seeing the `Console.messageAdded` event fired when console messages are written. 
The Runtime.consoleAPICalled event is related to using the API the console provides and not logs written to it, as far as I recall.

Niranjan Rao

unread,
Jul 17, 2023, 1:25:12 PM7/17/23
to chrome-debug...@googlegroups.com

Thank you for quick reply. I'll investigate.


Regards,


Niranjan

On 7/17/23 10:15, 'Ophir Back' via chrome-debugging-protocol wrote:
Take a look at the Console domain - https: //chromedevtools. github. io/devtools-protocol/tot/Console/ After you call `Console. enable()`, you should be seeing the `Console. messageAdded` event fired when console messages are written. The Runtime. consoleAPICalled
ZjQcmQRYFpfptBannerStart
This Message Is From an External Sender
 
ZjQcmQRYFpfptBannerEnd
This electronic communication and the information and any files transmitted with it, or attached to it, are confidential and are intended solely for the use of the individual or entity to whom it is addressed and may contain information that is confidential, legally privileged, protected by privacy laws, or otherwise restricted from disclosure to anyone else. If you are not the intended recipient or the person responsible for delivering the e-mail to the intended recipient, you are hereby notified that any use, copying, distributing, dissemination, forwarding, printing, or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please return the e-mail to the sender, delete it from your computer, and destroy any printed copy of it. --
You received this message because you are subscribed to the Google Groups "chrome-debugging-protocol" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-debugging-p...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/chrome-debugging-protocol/cb3d927b-31cb-4d51-8037-126e907cd724n%40googlegroups.com.
--
Niranjan Rao | Sr.Architect
he/his
Paymentus
Paymentus Corporation The Real-Time Bill Payment CompanyTM
860 Hillview Court Suite 220 Milpitas CA 95035
www.paymentus.com

Reply all
Reply to author
Forward
0 new messages