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

Deprecate LoggingClient in favor of a separate logger dictionary #757

Merged
merged 1 commit into from
May 9, 2024

Conversation

Page-
Copy link
Collaborator

@Page- Page- commented May 7, 2024

Change-type: patch

@Page- Page- requested a review from a team May 7, 2024 18:14
@Page- Page- enabled auto-merge May 7, 2024 18:14
@@ -676,18 +676,19 @@ export const executeModels = async (
api[apiRoot].logger = { ...console };
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Avoiding this awkward monkey patching of the pinejs client instance is the main benefit, since it won't persist on a .clone or similar and generally makes typing life there a lot harder because it means we get the following issues:

const clone = loggingClient.clone()
clone.logger.log() // Cannot call `log` of undefined
// typeof clone !== typeof loggingClient

and makes typing around cloning just an unnecessary pain

@joshbwlng
Copy link
Contributor

Looks like somethings going wrong at runtime:

 Exception during run: TypeError: Cannot read properties of undefined (reading 'migrations')
    at Object.<anonymous> (/home/runner/work/pinejs/pinejs/src/migrator/async.ts:31:19)

@Page-
Copy link
Collaborator Author

Page- commented May 8, 2024

@joshbwlng it must be because I changed (sbvrUtils.api?.migrations?.logger.info ?? console.info)( to remove that first ? because the variable is immediately declared so should never be able to be undefined.. I'm guessing it's because of import ordering and cyclic dependencies so I've put that ? back and assuming it'll be fixed when moving to ESM (because it'll either just work or break until it's fixed properly)

@Page- Page- merged commit d4b06f7 into master May 9, 2024
49 checks passed
@Page- Page- deleted the logger-dict branch May 9, 2024 00:18
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.

None yet

2 participants