Fix MacOS bundled launch with sanic logging dir.

This commit is contained in:
Matthew Stratford 2021-09-09 00:34:54 +01:00
parent 217a7dfdf3
commit ce17793c5e
3 changed files with 8 additions and 4 deletions

View file

@ -29,5 +29,6 @@ cd build
brew install platypus
platypus --load-profile ./BAPSicle.platypus --overwrite ./output/BAPSicle.app
chmod +x output/BAPSicle.app/Contents/Resources/BAPSicle
rm ../build.py

View file

@ -70,7 +70,7 @@ if __name__ == "__main__":
if sys.argv[1] == "Presenter":
webbrowser.open("http://localhost:13500/presenter/")
except Exception as e:
print("ALERT:BAPSicle failed with exception of type {}:\n{}".format(type(e).__name__, str(e)))
print("ALERT:BAPSicle failed with exception of type {}:{}".format(type(e).__name__, e))
sys.exit(1)
sys.exit(0)

View file

@ -26,7 +26,10 @@ from helpers.myradio_api import MyRadioAPI
env = Environment(loader=FileSystemLoader('%s/ui-templates/' % os.path.dirname(__file__)), autoescape=select_autoescape())
LOG_FILEPATH = resolve_external_file_path("logs")
LOG_FILENAME = LOG_FILEPATH + "/WebServer.log"
# From Sanic's default, but set to log to file.
os.makedirs(LOG_FILEPATH, exist_ok=True)
LOGGING_CONFIG = dict(
version=1,
disable_existing_loggers=False,
@ -49,17 +52,17 @@ LOGGING_CONFIG = dict(
"file": {
"class": "logging.FileHandler",
"formatter": "generic",
"filename": "logs/WebServer.log"
"filename": LOG_FILENAME
},
"error_file": {
"class": "logging.FileHandler",
"formatter": "generic",
"filename": "logs/WebServer.log"
"filename": LOG_FILENAME
},
"access_file": {
"class": "logging.FileHandler",
"formatter": "access",
"filename": "logs/WebServer.log"
"filename": LOG_FILENAME
},
},
formatters={