Best method to add a log console to a widget/kernel

Hello everyone,

I am developing an extension that entails a react widget interacting with a kernel. In order to get logs around the execution happening on the kernel I’d like to be able to open a log console attached to the opened widget.

I have of course checked out the two examples from this repository.

While those two examples (custom log console vs embedded notebook console) are helpful, I found myself wanting to achieve kind of a mix of both. For each instance of my widget, I want to be able to open a unique custom log console, linked to my widget and its kernel. (same behavior as notebooks but for my custom widget)

What’s the best strategy to attach a log console to my widget/kernel? Do I need to handle the creation of a custom log console for each new instance of my widget? Isn’t there an easy way to log messages just like notebook does (notebook native log console)?

I hope this is clear. Any advice and/or guidance would be greatly appreciated.

Thank you in advance,

Thibaut