Skip to content

Commit

Permalink
Log errors in JupyterLab preview to server logs (#4773)
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr authored May 4, 2023
1 parent d822dba commit 771d6a5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions panel/io/jupyter_server_extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async def _get_info(self, msg_id, timeout=KERNEL_TIMEOUT):
elif msg_type == 'comm_open' and msg['content']['target_name'] == self.session_id:
comm_id = msg['content']['comm_id']
elif msg_type == 'stream' and msg['content']['name'] == 'stderr':
logger.info(msg['content']['text'])
logger.error(msg['content']['text'])
return result, comm_id, extension_dirs

@tornado.web.authenticated
Expand Down Expand Up @@ -383,10 +383,12 @@ async def _check_for_message(self):
if not await ensure_async(self.kernel.is_alive()):
raise RuntimeError("Kernel died before expected shutdown of Panel app.")
continue
if not (
msg['header']['msg_type'] == 'comm_msg' and
msg['content']['comm_id'] == self.comm_id
):

msg_type = msg['header']['msg_type']
if msg_type == 'stream' and msg['content']['name'] == 'stderr':
logger.error(msg['content']['text'])
continue
elif not (msg_type == 'comm_msg' and msg['content']['comm_id'] == self.comm_id):
continue
content, metadata = msg['content'], msg['metadata']
status = metadata.get('status')
Expand Down

0 comments on commit 771d6a5

Please sign in to comment.