|
|
|
@ -1,11 +1,27 @@ |
|
|
|
import os |
|
|
|
import logging |
|
|
|
from pathlib import Path |
|
|
|
|
|
|
|
import appdirs |
|
|
|
import toml |
|
|
|
|
|
|
|
|
|
|
|
def ensure_exists(filepath): |
|
|
|
p = Path(filepath) |
|
|
|
p.mkdir(parents=True, exist_ok=True) |
|
|
|
return p |
|
|
|
|
|
|
|
|
|
|
|
my_appdirs = appdirs.AppDirs("panera_shifts_gcal") |
|
|
|
os.makedirs(my_appdirs.user_config_dir, exist_ok=True) |
|
|
|
config_file = Path(my_appdirs.user_config_dir) / "config.toml" |
|
|
|
|
|
|
|
config_dir = ensure_exists(my_appdirs.user_config_dir) |
|
|
|
log_dir = ensure_exists(my_appdirs.user_log_dir) |
|
|
|
|
|
|
|
config_file = config_dir / "config.toml" |
|
|
|
log_conf = config_dir / "logging.toml" |
|
|
|
with config_file.open() as config: |
|
|
|
config = toml.load(config) |
|
|
|
|
|
|
|
with log_conf.open() as log_conf: |
|
|
|
logging_config = toml.load(log_conf) |
|
|
|
|
|
|
|
panera_shifts_logger = logging.getLogger("panera_shifts") |