New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DM-30301: Change Task logging from lsst.log to python logging #191
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
timj
force-pushed
the
tickets/DM-30301
branch
2 times, most recently
from
July 19, 2021 17:27
07c5caa
to
541c582
Compare
This was referenced Jul 19, 2021
ktlim
approved these changes
Jul 22, 2021
Uses a special subclass of logging.Logger to allow some period of migration for usage in existing Tasks.
LoggingAdapter can apply to the root logger so allows for more consistency in usage.
Messages are still all forwarded to lsst.log for now.
Using self.log is not reliable since it might not be an lsst.log object any more.
We may end up always using this special logger.
Caller code should be fixed to configure logging or lsst.log as needed.
* verbose and trace are generally useful and may indicate we should always be using this log adapter. * Trap large log levels and assume they are lsst.log constants. * Add more Logger compatibility forwarding.
Python does not provide fatal() method on LoggingAdapter even though it does provide warn().
For verbose/trace/infof etc the messages were being reported from the wrong line. Setting stacklevel allows the log to report the correct line.
For now, we attach these constants to the log adapter so that it is easier to access the VERBOSE and TRACE constants. Do not deprecated any of them since python logging does not deprecated any (including WARN or FATAL). Getting the constants directly from the logger ensures self consistency for the Task user and hides the specific logging system from the Task.
For now assume that the log adapter for Task is going to exist as more than a transition class for the migration from lsst.log.
Since python itself does not deprecate it.
This makes the intent more explicit.
Co-authored-by: Kian-Tat Lim <ktl@slac.stanford.edu>
Recreate a new logger using the name from the supplied logger. This makes it more consistent with what `Task` is doing internally.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist
doc/changes