Some more logging stuff. log is now a global function as argument.

Don't know if it is good, but it made things easier to me.
This commit is contained in:
Johannes Findeisen 2022-10-06 02:42:15 +02:00
commit 7e228a3196
33 changed files with 188 additions and 204 deletions

View file

@ -7,17 +7,16 @@ import configparser
import glob
import os
from linspector.core.helpers import log
# TODO: check for all required configuration options and set defaults if needed. do this only for
# options in the "linspector" section of linspector.ini.
class Configuration:
def __init__(self, configuration_path, environment):
def __init__(self, configuration_path, environment, log):
self.__configuration = configparser.ConfigParser()
self.__configuration_path = configuration_path
self.__environment = environment
self.__log = log
log('info', 'reading configuration file: ' + configuration_path + '/linspector.conf')
if os.path.isfile(configuration_path + '/linspector.conf'):
@ -38,7 +37,7 @@ class Configuration:
section_list = glob.glob(configuration_path + '/' + target_section + '/*.conf')
for section_file in section_list:
#print(__file__ + ' (45): ' + section_file)
log('debug', 'reading section file: ' + section_file)
configuration = configparser.ConfigParser()
configuration.read(section_file, 'utf-8')
for source_section in configuration.sections():

View file

@ -11,19 +11,17 @@ from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.memory import MemoryJobStore
from apscheduler.executors.pool import ThreadPoolExecutor, ProcessPoolExecutor
from linspector.core.helpers import log
def job_function(monitor):
monitor.handle_call()
class Linspector:
def __init__(self, configuration, environment, monitors, plugins, scheduler):
def __init__(self, configuration, environment, log, monitors, plugins, scheduler):
self.__configuration = configuration
self.__environment = environment
self.__jobs = []
self.__log = log
self.__monitors = monitors
self.__plugin_list = []
self.__plugins = plugins

View file

@ -10,19 +10,19 @@ import importlib
from datetime import datetime
from binascii import crc32
from linspector.core.helpers import log
from linspector.core.task import Task, TaskExecutor
class Monitor:
def __init__(self, configuration, environment, identifier, monitor_configuration, notifications,
services, tasks, kwargs):
def __init__(self, configuration, environment, identifier, log, monitor_configuration,
notifications, services, tasks, kwargs):
self.__args = kwargs
self.__configuration = configuration
self.__environment = environment
self.__identifier = identifier
self.__interval = int(monitor_configuration.get('monitor', 'interval'))
self.__log = log
self.__monitor_configuration = monitor_configuration
self.__notification_list = []
self.__notifications = notifications
@ -30,7 +30,6 @@ class Monitor:
self.__services = services
self.__task_list = [] # put tasks for the dedicated job here.
self.__tasks = tasks
self.service = self.__service
self.host = monitor_configuration.get('monitor', 'hosts')
@ -83,7 +82,7 @@ class Monitor:
if notification_option not in notifications:
notification_package = 'linspector.notifications.' + notification_option.lower()
notification_module = importlib.import_module(notification_package)
notification = notification_module.create(configuration, environment)
notification = notification_module.create(configuration, environment, log)
notifications[notification_option.lower()] = notification
except configparser.NoOptionError as err:
self.__notifications = notifications
@ -95,7 +94,7 @@ class Monitor:
service_module = importlib.import_module(service_package)
self.__service = monitor_configuration.get('monitor', 'service').lower()
service = service_module.create(configuration, environment)
service = service_module.create(configuration, environment, log)
self.__services[monitor_configuration.get('monitor', 'service').lower()] = service
try:
if configuration.get_option('linspector', 'tasks') or \
@ -119,7 +118,7 @@ class Monitor:
if task_option not in tasks:
task_package = 'linspector.tasks.' + task_option.lower()
task_module = importlib.import_module(task_package)
task = task_module.create(configuration, environment)
task = task_module.create(configuration, environment, log)
tasks[task_option.lower()] = task
except configparser.NoOptionError:
self.__tasks = tasks
@ -194,13 +193,13 @@ class Monitor:
def handle_tasks(self, monitor_information):
for task in self.__tasks:
if self.status.lower() in task.get_task_type().lower():
log('debug', 'executing task of type: ' + self.status)
self.__log('debug', 'executing task of type: ' + self.status)
# tasks can but should not be executed here. putting them in a queue is the better
# solution to execute them in a serial process.
#TaskExecutor.instance().schedule_task(monitor_information, task)
def handle_call(self):
log('info', 'handle call to monitor with identifier: ' + self.__identifier)
self.__log('info', 'handle call to monitor with identifier: ' + self.__identifier)
#logger.debug("handle call")
#logger.debug(self.service)
if self.enabled:
@ -210,7 +209,7 @@ class Monitor:
#self.__services[self.__service].execute(self.last_execution)
self.__services[self.__service].execute(**self.__args)
except Exception as err:
log('error', err)
self.__log('error', err)
#self.last_execution.set_execution_end()
@ -226,7 +225,7 @@ class Monitor:
#self.handle_tasks(self.monitor_information)
else:
log('info', "job " + self.get_job_id() + " disabled")
self.__log('info', "job " + self.get_job_id() + " disabled")
def get_host(self):
return self.host

View file

@ -9,17 +9,16 @@ import glob
import os
from linspector.core.monitor import Monitor
from linspector.core.helpers import log
# monitors may could / should be added (and maybe changed) at runtime to add new monitors without
# restarting the daemon. maybe add a reset function to each monitor to reset the monitor at runtime
# when changed dynamically.
class Monitors:
def __init__(self, configuration, environment, notifications, services, tasks):
def __init__(self, configuration, environment, log, notifications, services, tasks):
self.__configuration = configuration
self.__environment = environment
self.__log = log
self.__monitors = {}
monitor_groups = os.listdir(self.__configuration.get_configuration_path() + '/monitors/')
@ -39,7 +38,9 @@ class Monitors:
kwargs = {}
for option in monitor_configuration.options('args'):
value = monitor_configuration.get('args', option)
#log('debug', 'added option to kwargs: ' + option + ' = ' + value)
log('debug', 'added option in ' + identifier + ' to kwargs: ' + option + ' = '
+ value)
kwargs[option] = value
if kwargs:
@ -51,7 +52,7 @@ class Monitors:
# create Monitor() object and copy monitor_configuration for each instance because
# they else refer to the same object.
self.__monitors[identifier] = Monitor(configuration, environment, identifier,
monitor_configuration, notifications,
log, monitor_configuration, notifications,
services, tasks, copy.deepcopy(kwargs))
del kwargs

View file

@ -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 Notification:
def __init__(self, configuration, environment):
def __init__(self, configuration, environment, log):
super().__init__()
self.__configuration = configuration
self._environment = environment
self.__environment = environment
self.__log = log

View file

@ -3,11 +3,10 @@ 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 Service:
def __init__(self, configuration, environment):
def __init__(self, configuration, environment, log):
self.__configuration = configuration
self._environment = environment
self.__log = log

View file

@ -6,7 +6,6 @@ See LICENSE (MIT license)
from queue import Queue
from threading import Event, Thread
from linspector.core.helpers import log
from linspector.core.singleton import Singleton
KEY_TYPE = "type"
@ -15,11 +14,12 @@ KEY_CLASS = "class"
class Task:
def __init__(self, configuration, environment, **kwargs):
def __init__(self, configuration, environment, log, **kwargs):
self._args = {}
self.__configuration = configuration
self._environment = environment
self.__log = log
self._args = {}
if KEY_ARGS in kwargs:
self.add_arguments(kwargs[KEY_ARGS])
elif self.needs_arguments():
@ -66,7 +66,10 @@ class Task:
# when tasks are being implemented.
@Singleton
class TaskExecutor:
def __init__(self):
def __init__(self, configuration, environment, log):
self.__configuration = configuration
self.__environment = environment
self.__log = log
self.queue = Queue()
self.taskInfos = []
task_thread = Thread(target=self._run_worker_thread)
@ -81,12 +84,12 @@ class TaskExecutor:
try:
msg, task = self.queue.get()
if task:
log('debug', "starting task execution...")
self.__log('debug', "starting task execution...")
#task.execute(msg)
self.queue.task_done()
except Exception as err:
log('error', "error " + str(err))
self.__log('error', "error " + str(err))
def is_instant_end(self):
return self._instantEnd

View file

@ -3,17 +3,16 @@ 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.notification import Notification
def create(configuration, environment):
return CallNotification(configuration, environment)
def create(configuration, environment, log):
return CallNotification(configuration, environment, log)
class CallNotification(Notification):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,17 +3,16 @@ 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.notification import Notification
def create(configuration, environment):
return EmailNotification(configuration, environment)
def create(configuration, environment, log):
return EmailNotification(configuration, environment, log)
class EmailNotification(Notification):
def __init__(self, configuration, environment):
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -5,17 +5,16 @@ See LICENSE (MIT license)
"""
import gammu
from linspector.core.helpers import log
from linspector.core.notification import Notification
def create(configuration, environment):
return SMSNotification(configuration, environment)
def create(configuration, environment, log):
return SMSNotification(configuration, environment, log)
class SMSNotification(Notification):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,17 +3,16 @@ 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.notification import Notification
def create(configuration, environment):
return TwitterNotification(configuration, environment)
def create(configuration, environment, log):
return TwitterNotification(configuration, environment, log)
class TwitterNotification(Notification):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -5,17 +5,16 @@ See LICENSE (MIT license)
"""
import xmpp
from linspector.core.helpers import log
from linspector.core.notification import Notification
def create(configuration, environment):
return XMPPNotification(configuration, environment)
def create(configuration, environment, log):
return XMPPNotification(configuration, environment, log)
class XMPPNotification(Notification):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,20 +3,19 @@ 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.service import Service
def create(configuration, environment):
return HTTPKeywordService(configuration, environment)
def create(configuration, environment, log):
return HTTPKeywordService(configuration, environment, log)
class HTTPKeywordService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -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.service import Service
def create(configuration, environment):
return DummyService(configuration, environment)
def create(configuration, environment, log):
return DummyService(configuration, environment, log)
class DummyService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
log('debug', 'DummyService object ' + str(self) + ' using kwargs: ' + str(kwargs))
self.__log('debug', 'DummyService object ' + str(self) + ' using kwargs: ' + str(kwargs))
#log('debug', 'dummy object @' + str(self) + str(self.__kwargs['foo']))
return

View file

@ -3,20 +3,19 @@ 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.service import Service
def create(configuration, environment):
return RandomService(configuration, environment)
def create(configuration, environment, log):
return RandomService(configuration, environment, log)
class RandomService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -5,21 +5,20 @@ See LICENSE (MIT)
"""
from fritzconnection.lib.fritzstatus import FritzStatus
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return FritzboxPhoneStatusService(configuration, environment)
def create(configuration, environment, log):
return FritzboxPhoneStatusService(configuration, environment, log)
class FritzboxPhoneStatusService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
log('debug', 'FritzboxPhoneStatusService object ' + str(self))
self.__log('debug', 'FritzboxPhoneStatusService object ' + str(self))
return

View file

@ -5,21 +5,20 @@ See LICENSE (MIT)
"""
from fritzconnection.lib.fritzstatus import FritzStatus
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return FritzboxUplinkService(configuration, environment)
def create(configuration, environment, log):
return FritzboxUplinkService(configuration, environment, log)
class FritzboxUplinkService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
log('debug', 'FritzboxUplinkService object ' + str(self) + ' using kwargs: ' + str(kwargs))
self.__log('debug', 'FritzboxUplinkService object ' + str(self) + ' using kwargs: ' + str(kwargs))
return

View file

@ -3,20 +3,19 @@ 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.service import Service
def create(configuration, environment):
return PingService(configuration, environment)
def create(configuration, environment, log):
return PingService(configuration, environment, log)
class PingService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -5,20 +5,19 @@ See LICENSE (MIT license)
"""
import socket
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return PortService(configuration, environment)
def create(configuration, environment, log):
return PortService(configuration, environment, log)
class PortService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, execution, **kwargs):

View file

@ -7,20 +7,19 @@ import calendar
import requests
import time
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return SpeedtestService(configuration, environment)
def create(configuration, environment, log):
return SpeedtestService(configuration, environment, log)
class SpeedtestService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
self.__speedtest_maximum_speed = None
self.__speedtest_average_speed = None
@ -65,10 +64,10 @@ class SpeedtestService(Service):
self.__speedtest_time_elapsed = time.perf_counter() - start
self.__environment.set_env_var('_speedtest_time_elapsed',
str(self.__speedtest_time_elapsed))
logger.info('speedtest average: ' + str(self.__speedtest_average_speed) +
', max: ' + str(self.__speedtest_maximum_speed) +
', time: ' + str(self.__speedtest_time_elapsed))
self.__log('info', 'speedtest average: ' + str(self.__speedtest_average_speed) +
', max: ' + str(self.__speedtest_maximum_speed) +
', time: ' + str(self.__speedtest_time_elapsed))
else:
logger.warning('could not calculate download speed!')
self.__log('warning', 'could not calculate download speed!')
time.sleep(self.__configuration.get_speedtest_interval())

View file

@ -7,20 +7,19 @@ import os
import paramiko
import pprint
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return SSHService(configuration, environment)
def create(configuration, environment, log):
return SSHService(configuration, environment, log)
class SSHService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
path = os.path.join(os.environ['HOME'], '.ssh', 'id_rsa')

View file

@ -3,21 +3,20 @@ 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.service import Service
def create(configuration, environment):
return TCPConnectService(configuration, environment)
def create(configuration, environment, log):
return TCPConnectService(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class TCPConnectService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -5,20 +5,19 @@ See LICENSE (MIT license)
"""
from pysnmp.entity.rfc3413.oneliner import cmdgen
from linspector.core.helpers import log
from linspector.core.service import Service
def create(configuration, environment):
return GetService(configuration, environment)
def create(configuration, environment, log):
return GetService(configuration, environment, log)
class GetService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -3,21 +3,19 @@ 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.service import Service
def create(configuration, environment):
return ShellService(configuration, environment)
def create(configuration, environment, log):
return ShellService(configuration, environment, log)
class ShellService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -3,20 +3,19 @@ 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.service import Service
def get(configuration, environment):
return UptimeService(configuration, environment)
def get(configuration, environment, log):
return UptimeService(configuration, environment, log)
class UptimeService(Service):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log
def execute(self, **kwargs):
return

View file

@ -3,18 +3,17 @@ 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.task import Task
def create(configuration, environment):
return CSVTask(configuration, environment)
def create(configuration, environment, log):
return CSVTask(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class CSVTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,18 +3,18 @@ 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.task import Task
def create(configuration, environment):
return FileLoggerTask(configuration, environment)
def create(configuration, environment, log):
return FileLoggerTask(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class FileLoggerTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,18 +3,17 @@ 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.task import Task
def create(configuration, environment):
return MariaDBTask(configuration, environment)
def create(configuration, environment, log):
return MariaDBTask(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class MariaDBTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,18 +3,17 @@ 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.task import Task
def create(configuration, environment):
return RedisTask(configuration, environment)
def create(configuration, environment, log):
return RedisTask(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class RedisTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log

View file

@ -3,18 +3,18 @@ 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.task import Task
def create(configuration, environment):
return SQLiteTask(configuration, environment)
def create(configuration, environment, log):
return SQLiteTask(configuration, environment, log)
# TODO: check for all required configuration options and set defaults if needed.
class SQLiteTask(Task):
def __init__(self, configuration, environment):
super().__init__(configuration, environment)
def __init__(self, configuration, environment, log):
super().__init__(configuration, environment, log)
self.__configuration = configuration
self.__environment = environment
self.__log = log