Skip to content

Commit

Permalink
Fix packaging logging.conf.
Browse files Browse the repository at this point in the history
I note that the application will not run in a local environment UNLESS
run with a working directory that is the root of the repo.
  • Loading branch information
manthey committed Nov 8, 2023
1 parent a6cd064 commit 11cc76f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
recursive-include imagedephi *.yaml *.j2
recursive-include imagedephi *.yaml *.j2 logging.conf

prune .github
prune docs
Expand Down
11 changes: 10 additions & 1 deletion imagedephi/utils/logger.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
import importlib.resources
import logging
import logging.config
import os

logging.config.fileConfig("logging.conf")
try:
logging.config.fileConfig(
"logging.conf"
if os.path.exists("logging.conf")
else importlib.resources.files("imagedephi") / "logging.conf"
)
except KeyError:
pass

logger = logging.getLogger("root")

0 comments on commit 11cc76f

Please sign in to comment.