Fix issues with log level retention #187
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fastspec --verbose sets the log level to DEBUG, but this level unexpectedly reverts to INFO when imports from the DESI libraries implicitly invoke get_logger(), which reset the log level. There seems to be no safe way to avoid this with desiutil.log, since it always returns the same log object that the DESI libraries themselves use internally. So, make our global 'log' object distinct from desutil's by creating it with a new domain ('fastspec').
While we're at it, make sure the log level is set in the singlecopy initialization code, so that it happens in subprocesses as well as the parent process when running in mp mode. (This isn't being exercised now because multiprocessing uses fork, but it should futureproof us against Python 3.14+, which will switch to spawn.)