renamed get() to create() in plugins and added the log to args.
This commit is contained in:
parent
04e30b3301
commit
1fc684c7e0
5 changed files with 14 additions and 16 deletions
|
|
@ -37,7 +37,7 @@ logger = logging.getLogger('linspector')
|
|||
|
||||
# i currently only increase the 3rd number because the goal is that 0.19.* will become the first
|
||||
# stable version.
|
||||
__version__ = '0.19.37.dev1'
|
||||
__version__ = '0.19.38.dev1'
|
||||
__author__ = 'Johannes Findeisen <you@hanez.org>'
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Linspector:
|
|||
log('info', 'loading plugin: ' + plugin_option)
|
||||
plugin_package = 'linspector.plugins.' + plugin_option.lower()
|
||||
plugin_module = importlib.import_module(plugin_package)
|
||||
plugin = plugin_module.get(configuration, environment, self)
|
||||
plugin = plugin_module.create(configuration, environment, log, self)
|
||||
plugins[plugin_option.lower()] = plugin
|
||||
|
||||
jobstores = {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,11 @@ This file is part of Linspector (https://linspector.org/)
|
|||
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
|
||||
See LICENSE (MIT license)
|
||||
"""
|
||||
from linspector.core.helpers import log
|
||||
|
||||
|
||||
class Plugin:
|
||||
|
||||
def __init__(self, configuration, environment, linspector):
|
||||
def __init__(self, configuration, environment, linspector, log):
|
||||
self.__configuration = configuration
|
||||
self._environment = environment
|
||||
self.__linspector = linspector
|
||||
self.__log = log
|
||||
|
|
|
|||
|
|
@ -6,22 +6,22 @@ See LICENSE (MIT license)
|
|||
import cherrypy
|
||||
import json
|
||||
|
||||
from linspector.core.helpers import log
|
||||
from linspector.core.plugin import Plugin
|
||||
|
||||
|
||||
def get(configuration, environment, linspector):
|
||||
return HTTPServerPlugin(configuration, environment, linspector)
|
||||
def create(configuration, environment, linspector, log):
|
||||
return HTTPServerPlugin(configuration, environment, linspector, log)
|
||||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class HTTPServerPlugin(Plugin):
|
||||
|
||||
def __init__(self, configuration, environment, linspector):
|
||||
super().__init__(configuration, environment, linspector)
|
||||
def __init__(self, configuration, environment, linspector, log):
|
||||
super().__init__(configuration, environment, linspector, log)
|
||||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
self.__linspector = linspector
|
||||
self.__log = log
|
||||
|
||||
@cherrypy.expose
|
||||
def index(self):
|
||||
|
|
|
|||
|
|
@ -3,22 +3,21 @@ This file is part of Linspector (https://linspector.org/)
|
|||
Copyright (c) 2022 Johannes Findeisen <you@hanez.org>. All Rights Reserved.
|
||||
See LICENSE (MIT license)
|
||||
"""
|
||||
from linspector.core.helpers import log
|
||||
from linspector.core.plugin import Plugin
|
||||
|
||||
|
||||
def get(configuration, environment, linspector):
|
||||
return LishPlugin(configuration, environment, linspector)
|
||||
def create(configuration, environment, linspector, log):
|
||||
return LishPlugin(configuration, environment, linspector, log)
|
||||
|
||||
|
||||
# TODO: check for all required configuration options and set defaults if needed.
|
||||
class LishPlugin(Plugin):
|
||||
|
||||
def __init__(self, configuration, environment, linspector):
|
||||
super().__init__(configuration, environment, linspector)
|
||||
def __init__(self, configuration, environment, linspector, log):
|
||||
super().__init__(configuration, environment, linspector, log)
|
||||
self.__configuration = configuration
|
||||
self.__environment = environment
|
||||
self.__linspector = linspector
|
||||
self.__log = log
|
||||
|
||||
def run(self):
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue