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

1st attempt to reveal magic parts #54

Merged
merged 2 commits into from
Aug 7, 2017

Conversation

coderofsalvation
Copy link
Collaborator

many npm packages use the debug-module during development. This allows you to see more output in the console:

$ DEBUG=* npm run dev

And you'll see the debug()-statements (instead of only the console.log statements)

The good thing is that addListener()-automatically uses this mechanism, which allows us to see which listeners are triggered.
I think there are more parts in the code which might need some debug calls

listeners.js Outdated
}
})

api.addListener(['post', 'put'], function updatePassword(req, collection, data) {
if (collection == 'users' && data.password && data.password.length != 60 && data.password[0] != "$") {
debug('setting new password')
Copy link
Owner

Choose a reason for hiding this comment

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

Maybe mention hashing in this comment, since it's pretty important that the plaintext password field is replaced with a hashed version.

@thomas4019
Copy link
Owner

Looks like a good change. Each of these listeners should already get logged by name e.g. I see the output below when enabling debugging.

expressa notifying 6 of get +1ms
expressa calling hidePasswordHashes +0ms
expressa calling +0ms
expressa calling allowViewOwnUser +0ms
expressa calling viewRelevantCollections +0ms
expressa calling collectionPermissionCheck +1ms
expressa calling addMetaToSchema +0ms

But I guess the names aren't very clear. I'm fine with your proposed adding of debug statements or we could make the function names longer so it's more clear what's going on, or maybe both :)

@thomas4019 thomas4019 merged commit 13ac88f into thomas4019:master Aug 7, 2017
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