diff --git a/plugin.video.external.library/commands.py b/plugin.video.external.library/commands.py index 8de89b6..d3163db 100644 --- a/plugin.video.external.library/commands.py +++ b/plugin.video.external.library/commands.py @@ -13,7 +13,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -import logging import sys import xbmc @@ -24,7 +23,6 @@ from libs.kodi_service import GettextEmulator, initialize_logging initialize_logging() -logger = logging.getLogger(__name__) _ = GettextEmulator.gettext @@ -39,5 +37,5 @@ def main(): if __name__ == '__main__': - with catch_exception(logger.error): + with catch_exception(): main() diff --git a/plugin.video.external.library/libs/exception_logger.py b/plugin.video.external.library/libs/exception_logger.py index 928dd80..36e40d3 100644 --- a/plugin.video.external.library/libs/exception_logger.py +++ b/plugin.video.external.library/libs/exception_logger.py @@ -15,6 +15,7 @@ """Exception logger with extended diagnostic info""" import inspect +import logging import sys from contextlib import contextmanager from platform import uname @@ -23,9 +24,7 @@ import xbmc - -def _log_error(message: str) -> None: - xbmc.log(message, level=xbmc.LOGERROR) +logger = logging.getLogger(__name__) def _format_vars(variables: Dict[str, Any]) -> str: @@ -156,7 +155,7 @@ def format_exception(exc_obj: Optional[Exception] = None) -> str: @contextmanager -def catch_exception(logger_func: Callable[[str], None] = _log_error) -> Generator[None, None, None]: +def catch_exception(logger_func: Callable[[str], None] = logger.error) -> Generator[None, None, None]: """ Diagnostic helper context manager diff --git a/plugin.video.external.library/main.py b/plugin.video.external.library/main.py index 4ddcfc9..a61ea79 100644 --- a/plugin.video.external.library/main.py +++ b/plugin.video.external.library/main.py @@ -14,15 +14,13 @@ # along with this program. If not, see . import sys -import logging from libs.actions import router from libs.exception_logger import catch_exception from libs.kodi_service import initialize_logging initialize_logging() -logger = logging.getLogger(__name__) if __name__ == '__main__': - with catch_exception(logger.error): + with catch_exception(): router(sys.argv[2][1:]) diff --git a/plugin.video.external.library/service.py b/plugin.video.external.library/service.py index 044f209..009cf6f 100644 --- a/plugin.video.external.library/service.py +++ b/plugin.video.external.library/service.py @@ -24,7 +24,7 @@ initialize_logging() logger = logging.getLogger(__name__) -with catch_exception(logger.error): +with catch_exception(): logger.debug('Starting playback monitoring service...') kodi_monitor = xbmc.Monitor() play_monitor = PlayMonitor()