Skip to content

Commit

Permalink
write server extension list to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Dec 20, 2024
1 parent 63053d2 commit c23aeb1
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions jupyter_server/extension/serverextension.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def toggle_server_extension(self, import_name: str) -> None:
# If successful, let's log.
self.log.info(f" - Extension successfully {self._toggle_post_message}.")
except Exception as err:
self.log.info(f" {RED_X} Validation failed: {err}")
self.log.error(f" {RED_X} Validation failed: {err}")

def start(self) -> None:
"""Perform the App's actions as configured"""
Expand Down Expand Up @@ -336,7 +336,7 @@ def list_server_extensions(self) -> None:

for option in configurations:
config_dir = _get_config_dir(**option)
self.log.info(f"Config dir: {config_dir}")
print(f"Config dir: {config_dir}")
write_dir = "jupyter_server_config.d"
config_manager = ExtensionConfigManager(
read_config_path=[config_dir],
Expand All @@ -345,20 +345,18 @@ def list_server_extensions(self) -> None:
jpserver_extensions = config_manager.get_jpserver_extensions()
for name, enabled in jpserver_extensions.items():
# Attempt to get extension metadata
self.log.info(f" {name} {GREEN_ENABLED if enabled else RED_DISABLED}")
print(f" {name} {GREEN_ENABLED if enabled else RED_DISABLED}")
try:
self.log.info(f" - Validating {name}...")
print(f" - Validating {name}...")
extension = ExtensionPackage(name=name, enabled=enabled)
if not extension.validate():
msg = "validation failed"
raise ValueError(msg)
version = extension.version
self.log.info(f" {name} {version} {GREEN_OK}")
print(f" {name} {version} {GREEN_OK}")
except Exception as err:
exc_info = False
if int(self.log_level) <= logging.DEBUG: # type:ignore[call-overload]
exc_info = True
self.log.warning(f" {RED_X} {err}", exc_info=exc_info)
self.log.debug("", exc_info=True)
print(f" {RED_X} {err}")
# Add a blank line between paths.
self.log.info("")

Expand Down

0 comments on commit c23aeb1

Please sign in to comment.