Skip to content

Commit

Permalink
Postpone the logging of the plugins list until start()
Browse files Browse the repository at this point in the history
  • Loading branch information
TaiSakuma committed Jan 26, 2024
1 parent 67e1f96 commit b1b5dbf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 2 additions & 1 deletion nextline/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .continuous import Continuous
from .fsm import Machine
from .plugin import Context, build_hook
from .plugin import Context, build_hook, log_loaded_plugins
from .spawned import PdbCommand
from .types import (
InitOptions,
Expand Down Expand Up @@ -86,6 +86,7 @@ async def start(self) -> None:
self._started = True
logger = getLogger(__name__)
logger.debug(f'self._init_options: {self._init_options}')
log_loaded_plugins(hook=self._hook)
context = Context(nextline=self, hook=self._hook, pubsub=self._pubsub)
self._hook.hook.init(context=context, init_options=self._init_options)
self._machine = Machine(context=context)
Expand Down
4 changes: 2 additions & 2 deletions nextline/plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__all__ = ['build_hook', 'Context']
__all__ = ['build_hook', 'log_loaded_plugins', 'Context']

from .hook import build_hook
from .hook import build_hook, log_loaded_plugins
from .spec import Context
7 changes: 3 additions & 4 deletions nextline/plugin/hook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,12 @@
def build_hook() -> PluginManager:
hook = PluginManager(spec.PROJECT_NAME)
hook.add_hookspecs(spec)

plugins.register(hook)
return hook

logger = getLogger(__name__)

def log_loaded_plugins(hook: PluginManager) -> None:
logger = getLogger(__name__)
plugin_names = [n for n, p in hook.list_name_plugin() if p]
logger.info(f'Pluggy project name: {hook.project_name!r}')
logger.info(f'Loaded plugins: {plugin_names}')

return hook

0 comments on commit b1b5dbf

Please sign in to comment.