-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: pass logger to integrations #7816
Conversation
🦋 Changeset detectedLatest commit: ab3b54e The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
1eb8b13
to
9c368e4
Compare
9c368e4
to
6a4cd35
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog and public API look good to me! Thanks @ematipico 💜
The diff is showing all changes unrelated to a logger. Like the capitalization change to API routes. Is that a mistake? |
6a4cd35
to
ab3b54e
Compare
@matthewp now it should be fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still somewhat on the side that we should only expose the logger in astro:config:done
, but if the rest are fine with exposing it in more hooks, I'm fine with it too 👍
Thank you @ematipico ! I just updated my integration to use the new |
Changes
I created two classes:
Logger
, basic class. The objective of this class is to be used internally in our codebase. Ideally, we will pass around an instance of this class instead of passinglogging
. I plan to make this change gradually in the future.AstroIntegrationLogger
, similar toLogger
, this class has thelabel
stored inside of it. The main idea is that integrations should not know anything about labels.If an integration needs to do some logging with a different label - which I assume it's rare - they can use the
fork
function, which returns a new logger which has the same logging options.Testing
Current tests should pass.
Docs
/cc @withastro/maintainers-docs for feedback!