Logging with levels to lab log console

I figured out that I could redirect print statements to the jupyter lab logging console via

import logging
logger = logging.getLogger()

but is there a way where I can log with levels and get that sent to the console? I want to write statements like:

logger.debug("shapes")
logger.error("yikes")

And currently not seeing them in console.

Thanks! (I :heart: the log console & want to exploit it as much as possible but am having trouble finding the docs).

1 Like

From what I can tell, looking at some of the code (https://github.com/jupyterlab/jupyterlab/blob/ac3ab8cbed744cbbaacf4871a7a9e152ef6c9086/packages/logconsole-extension/src/nboutput.ts#L32-L71) it will display any iopub messages with priority info. So if you do any normal outputs from Jupyter, (printing, IPython.core.display.display, etc) these will show up in the output widget?

Although @jasongrout would have more ideas probably…