Skip to content

Move logging setup out of __init__.py - #279

Merged
khoroshevskyi merged 2 commits into
devfrom
no-import-time-logging
Aug 7, 2026
Merged

Move logging setup out of __init__.py#279
khoroshevskyi merged 2 commits into
devfrom
no-import-time-logging

Conversation

@nsheff

@nsheff nsheff commented Aug 7, 2026

Copy link
Copy Markdown
Member

Importing bedhost used to configure logging as a side effect. __init__.py called logmuse.init_logger() and forced bbconf and geniml to DEBUG, so anything that imported the package got that whether it wanted it or not.

That belongs at the entry point instead. bedhost runs under uvicorn bedhost.main:app, so main.py is the entry point and the setup moved there unchanged. main() was not an option, since the CLI is not how the server is actually started.

__init__.py now just does logging.getLogger(PKG_NAME), which keeps the existing from . import _LOGGER imports in helpers.py, main.py, and bed_api.py working. It is the same logger object that main.py configures, so startup logging is unaffected.

Requires logmuse 0.3.0.

Unrelated, noticed while working here and not fixed in this PR: cli.py refers to CFG_ENV_VARS, which is not defined or imported anywhere, so build_parser() raises NameError and bedhost serve does not run. It has been that way for a while, which fits with everything going through uvicorn instead.

@nsheff
nsheff requested a review from khoroshevskyi August 7, 2026 16:50
@khoroshevskyi
khoroshevskyi merged commit f30e9a4 into dev Aug 7, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants