mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-19 00:04:08 +03:00
plugintest: Add event type to logging & convert to classed 'this'.
This commit is contained in:
parent
20645f0731
commit
0a437961a3
@ -6,7 +6,6 @@ import logging
|
|||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
import sqlite3
|
import sqlite3
|
||||||
import sys
|
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
from SubA import SubA
|
from SubA import SubA
|
||||||
@ -32,9 +31,16 @@ if not logger.hasHandlers():
|
|||||||
logger.addHandler(logger_channel)
|
logger.addHandler(logger_channel)
|
||||||
|
|
||||||
|
|
||||||
this = sys.modules[__name__] # For holding module globals
|
class This:
|
||||||
this.DBFILE = 'plugintest.db'
|
"""Module global variables."""
|
||||||
this.mt = None
|
|
||||||
|
def __init__(self):
|
||||||
|
self.DBFILE = 'plugintest.db'
|
||||||
|
self.plugin_test: PluginTest
|
||||||
|
self.suba: SubA
|
||||||
|
|
||||||
|
|
||||||
|
this = This()
|
||||||
|
|
||||||
|
|
||||||
class PluginTest(object):
|
class PluginTest(object):
|
||||||
@ -87,7 +93,7 @@ def plugin_start3(plugin_dir: str) -> str:
|
|||||||
:return: 'Pretty' name of this plugin.
|
:return: 'Pretty' name of this plugin.
|
||||||
"""
|
"""
|
||||||
logger.info(f'Folder is {plugin_dir}')
|
logger.info(f'Folder is {plugin_dir}')
|
||||||
this.mt = PluginTest(plugin_dir)
|
this.plugin_test = PluginTest(plugin_dir)
|
||||||
|
|
||||||
this.suba = SubA(logger)
|
this.suba = SubA(logger)
|
||||||
|
|
||||||
@ -117,5 +123,9 @@ def journal_entry(cmdrname: str, is_beta: bool, system: str, station: str, entry
|
|||||||
:param state:
|
:param state:
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
logger.debug(f'cmdr = "{cmdrname}", is_beta = "{is_beta}", system = "{system}", station = "{station}"')
|
logger.debug(
|
||||||
this.mt.store(entry['timestamp'], cmdrname, system, station, entry['event'])
|
f'cmdr = "{cmdrname}", is_beta = "{is_beta}"'
|
||||||
|
f', system = "{system}", station = "{station}"'
|
||||||
|
f', event = "{entry["event"]}'
|
||||||
|
)
|
||||||
|
this.plugin_test.store(entry['timestamp'], cmdrname, system, station, entry['event'])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user