Skip to content

Commit

Permalink
fix(debug): added syslog calls to make debugging easier
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Jan 26, 2022
1 parent f154883 commit 6c1d90e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion aw_qt/main.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys
import logging
import subprocess
import platform
import click
from typing import Optional

Expand All @@ -21,13 +23,23 @@
help="A comma-separated list of modules to autostart, or just `none` to not autostart anything.",
)
def main(testing: bool, autostart_modules: Optional[str]) -> None:
# Since the .app can crash when started from Finder for unknown reasons, we send a syslog message here to make debugging easier.
if platform.system() == "Darwin":
subprocess.call("syslog -s 'aw-qt started'", shell=True)

setup_logging("aw-qt", testing=testing, verbose=testing, log_file=True)
logger.info("Started aw-qt...")

# Since the .app can crash when started from Finder for unknown reasons, we send a syslog message here to make debugging easier.
if platform.system() == "Darwin":
subprocess.call("syslog -s 'aw-qt successfully started logging'", shell=True)

config = AwQtSettings(testing=testing)
_autostart_modules = (
[m.strip() for m in autostart_modules.split(",") if m and m.lower() != "none"]
if autostart_modules
else config.autostart_modules
)
setup_logging("aw-qt", testing=testing, verbose=testing, log_file=True)

_manager = Manager(testing=testing)
_manager.autostart(_autostart_modules)
Expand Down

0 comments on commit 6c1d90e

Please sign in to comment.