Skip to content

Commit 48a0ad5

Browse files
committed
fix: abstract logging to debug manager, this could allow for file logging as well as console logging
1 parent fa84e27 commit 48a0ad5

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

loopstructural/debug_manager.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ def __init__(self, plugin):
2929
self._debug_state_logged = False
3030
self.logger = self.plugin.log
3131

32+
def log(self, message: str, log_level: int = 0):
33+
"""Log a message via the plugin's logging mechanism."""
34+
self.plugin.log(message=message, log_level=log_level)
35+
36+
def message(self, message: str):
37+
"""Log an informational message via the plugin's logging mechanism."""
38+
self.plugin.log(message=message, log_level=0)
39+
3240
def _get_settings(self):
3341
return plg_prefs_hdlr.PlgOptionsManager.get_plg_settings()
3442

loopstructural/plugin_main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(self, iface: QgisInterface):
8080
self.data_manager = ModellingDataManager(
8181
mapCanvas=self.iface.mapCanvas(), logger=self.log, project=QgsProject.instance()
8282
)
83-
self.model_manager = GeologicalModelManager()
83+
self.model_manager = GeologicalModelManager(debug_manager=self.debug_manager)
8484
self.data_manager.set_model_manager(self.model_manager)
8585

8686
def injectLogHandler(self):

0 commit comments

Comments
 (0)