-
Notifications
You must be signed in to change notification settings - Fork 80
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: added debug
flag in the SuperTokenConfig
in the init()
for logging
#732
Conversation
✅ Deploy Preview for precious-marshmallow-968a81 canceled.
|
❌ Deploy Preview for astounding-pegasus-21c111 failed.
|
lib/ts/supertokens.ts
Outdated
@@ -49,6 +50,9 @@ export default class SuperTokens { | |||
telemetryEnabled: boolean; | |||
|
|||
constructor(config: TypeInput) { | |||
if (config.debug) { |
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.
- we also want it to work for with the env var like before (backwards compatibility)
- Doing implicit if is not a good idea. Make it
if (config.debug === true)
lib/ts/supertokens.ts
Outdated
@@ -48,7 +48,16 @@ export default class SuperTokens { | |||
|
|||
telemetryEnabled: boolean; | |||
|
|||
debugEnabled: boolean; |
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 variable should not be required, and even if it is, it should be in the logger.ts file
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.
It was only used in the tests, removed it.
lib/ts/logger.ts
Outdated
); | ||
console.log(); | ||
} | ||
debug(SUPERTOKENS_DEBUG_NAMESPACE)( |
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.
why aren't you checking for if (debug.enabled(SUPERTOKENS_DEBUG_NAMESPACE)) {
?
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.
We already call debug.enable()
when initialising the logger, so ideally this should always return true
. Added this check, just for safety.
Summary of change
debug
flag in theinit()
. Debug logs will be printed if this flag is set to true.DEBUG=com.supertokens
will continue to work.Related issues
Test Plan
(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos!)
Documentation changes
(If relevant, please create a PR in our docs repo, or create a checklist here highlighting the necessary changes)
Checklist for important updates
coreDriverInterfaceSupported.json
file has been updated (if needed)lib/ts/version.ts
frontendDriverInterfaceSupported.json
file has been updated (if needed)package.json
package-lock.json
lib/ts/version.ts
npm run build-pretty
recipe/thirdparty/providers/configUtils.ts
file,createProvider
function.git tag
) in the formatvX.Y.Z
, and then find the latest branch (git branch --all
) whoseX.Y
is greater than the latest released tag.add-ts-no-check.js
file to include thatsomeFunc: function () {..}
).Remaining TODOs for this PR