Skip to content
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-31060: Clean up some log message usage #386

Merged
merged 3 commits into from
Jul 17, 2021
Merged

Conversation

timj
Copy link
Member

@timj timj commented Jul 16, 2021

Checklist

  • ran Jenkins
  • added a release note for user-visible changes to doc/changes

timj added 3 commits July 16, 2021 09:37
lsst.log supports both but logging prefers warning.
The latter is not supported by python logging
@timj timj requested a review from parejkoj July 16, 2021 18:25
Copy link
Collaborator

@parejkoj parejkoj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for cleaning up the non-lazy formatted log messages, too. I think that's something we could use a more general reminder of to our developers, as I still see f-string log messages in new code.

@@ -1213,7 +1213,7 @@ def _standardizeExposure(self, mapping, item, dataId, filter=True,
exposure = exposureFromImage(item, dataId, mapper=self, logger=self.log,
setVisitInfo=setVisitInfo, setFilter=filter)
except Exception as e:
self.log.error("Could not turn item=%r into an exposure: %s" % (repr(item), e))
self.log.error("Could not turn item=%r into an exposure: %s", item, e)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That repr is probably there because we don't have good str for many objects, but that's something we should just fix when it comes up.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I was a bit confused why we were calling repr twice: once with repr and once with %r...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, ha! I didn't even notice that. Good catch.

@timj timj merged commit 9e3ad66 into master Jul 17, 2021
@timj timj deleted the tickets/DM-31060-obs_base branch July 17, 2021 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants