mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
log stages
This commit is contained in:
parent
36c0fad8e1
commit
4dc1ae4f5f
@ -2,6 +2,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import importlib
|
import importlib
|
||||||
import pathlib
|
import pathlib
|
||||||
|
import logging
|
||||||
from typing import OrderedDict
|
from typing import OrderedDict
|
||||||
|
|
||||||
from django.apps import AppConfig, apps
|
from django.apps import AppConfig, apps
|
||||||
@ -16,6 +17,8 @@ except:
|
|||||||
from plugin import plugins as inventree_plugins
|
from plugin import plugins as inventree_plugins
|
||||||
from plugin.integration import IntegrationPluginBase
|
from plugin.integration import IntegrationPluginBase
|
||||||
|
|
||||||
|
logger = logging.getLogger('inventree')
|
||||||
|
|
||||||
|
|
||||||
class PluginConfig(AppConfig):
|
class PluginConfig(AppConfig):
|
||||||
name = 'plugin'
|
name = 'plugin'
|
||||||
@ -36,6 +39,10 @@ class PluginConfig(AppConfig):
|
|||||||
plugin.is_package = True
|
plugin.is_package = True
|
||||||
settings.PLUGINS.append(plugin)
|
settings.PLUGINS.append(plugin)
|
||||||
|
|
||||||
|
# Log found plugins
|
||||||
|
logger.info(f'Found {len(settings.PLUGINS)} plugins!')
|
||||||
|
logger.info(", ".join([a.__module__ for a in settings.PLUGINS]))
|
||||||
|
|
||||||
# Initialize integration plugins
|
# Initialize integration plugins
|
||||||
for plugin in inventree_plugins.load_integration_plugins():
|
for plugin in inventree_plugins.load_integration_plugins():
|
||||||
# check if package
|
# check if package
|
||||||
@ -51,7 +58,9 @@ class PluginConfig(AppConfig):
|
|||||||
# init package
|
# init package
|
||||||
# now we can be sure that an admin has activated the plugin -> as of Nov 2021 there are not many checks in place
|
# now we can be sure that an admin has activated the plugin -> as of Nov 2021 there are not many checks in place
|
||||||
# but we could enhance those to check signatures, run the plugin against a whitelist etc.
|
# but we could enhance those to check signatures, run the plugin against a whitelist etc.
|
||||||
|
logger.info(f'Loading integration plugin {plugin.PLUGIN_NAME}')
|
||||||
plugin = plugin()
|
plugin = plugin()
|
||||||
|
logger.info(f'Loaded integration plugin {plugin.slug}')
|
||||||
plugin.is_package = was_packaged
|
plugin.is_package = was_packaged
|
||||||
# safe reference
|
# safe reference
|
||||||
settings.INTEGRATION_PLUGINS[plugin.slug] = plugin
|
settings.INTEGRATION_PLUGINS[plugin.slug] = plugin
|
||||||
|
Loading…
Reference in New Issue
Block a user