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

Logger only checks for andlogKey existence #8

Open
daver208 opened this issue Nov 17, 2015 · 2 comments
Open

Logger only checks for andlogKey existence #8

daver208 opened this issue Nov 17, 2015 · 2 comments

Comments

@daver208
Copy link

If the local storage andlogKey exists, the module logs to the console despite the value in localStorage. This is somewhat documented in that you state you should delete the key if you want to disable logging. That said it is somewhat misleading that setting ANY value for the andlogKey will allow log messages to to be output to the console. If you set the key to false, messages are still output.

@HenrikJoreteg
Copy link
Owner

hi @daver208, right you are.

Sorry you got hung up on this, as it turns out, this is actually because of how localStorage works.

It turns everything... including false into a string.

Try this in your browser console:

localStorage.something = false; typeof localStorage.something;

That said, it doesn't mean this module has to work this way. Open to suggestions, we could, for example, change it to check for the existance of the key and also make sure it's not the string false. Or, perhaps it should just be better explained in the readme.

What do you think?

@daver208
Copy link
Author

Either solution works for me, just opened the issue because it did trip me up. I was just setting the andlogKey value from clientconfig and was confused why it wasn't working.

It does seem a little cleaner to actually evaluate the key since you suggest setting the key value to true. That said, just documenting it a bit better would be sufficient.

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

No branches or pull requests

2 participants