Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

write server extension list to stdout #1451

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading