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

Added more debugging for bug-fixing #48

Merged
merged 18 commits into from
Mar 24, 2021
Merged

Conversation

ArnyminerZ
Copy link
Collaborator

Maybe too redundant, but added everything just in case it is useful. Take a look at it.

Closes #47.

Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ ArnyminerZ added feature New feature or request patch Patch changes. Used for release bump labels Mar 21, 2021
glocaltokens/utils/logs.py Outdated Show resolved Hide resolved
Comment on lines +160 to +162
_LOGGER.debug(
'Won\'t add device since model "{}" is not in models_list'.format(model)
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

@leikoilja is model_list still needed?

Copy link
Owner

Choose a reason for hiding this comment

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

Good question, @KapJI.
We have dropped to maintain this list in google-home, do you think we still need it in glocaltokens, @ArnyminerZ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Well, I don't know, it might be useful for someone, maybe. If it doesn't bother, I wouldn't remove it, just in case.

Copy link
Owner

Choose a reason for hiding this comment

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

Since we fallback to fetching all devices if no model_list is provided we can just keep it i guess :)

glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/scanner.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
Copy link
Owner

@leikoilja leikoilja left a comment

Choose a reason for hiding this comment

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

Reeeally good work, @ArnyminerZ, thanks a lot! 💣
We just need to clean it up a little and it's ready to be used!

Just a little question to both @ArnyminerZ and @KapJI, now this package checks global DEBUG variable flag and only if it's true it will show logging.debug. Is there any near way we can tag along the parent package/component logging level to use here?
Maybe we can pass an extra optional parameter when we initialize client, somewhat like verbose that will set logging level to debug? So then on a parent package/integration (google_home in our example) we can pass verbose based if a user have debug flag set in HA yaml configuration for google_home component?

glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
Comment on lines +160 to +162
_LOGGER.debug(
'Won\'t add device since model "{}" is not in models_list'.format(model)
)
Copy link
Owner

Choose a reason for hiding this comment

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

Good question, @KapJI.
We have dropped to maintain this list in google-home, do you think we still need it in glocaltokens, @ArnyminerZ?

Comment on lines 2 to 8
"""
Replaces all the characters in a str by the specified [replace]

text: The text to censure.
replace: The character to instead of the content.
"""
return replace * len(text)
Copy link
Owner

Choose a reason for hiding this comment

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

Since we are using this util to print tokens and passwords, we really should add a test to make sure we censor correctly and are not printing any user sensitive data to the log without their consent

@KapJI
Copy link
Collaborator

KapJI commented Mar 22, 2021

yeah, passing an extra flag sounds like a way to go. In HA component we can pass current verbosity level.

Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Copy link
Owner

@leikoilja leikoilja left a comment

Choose a reason for hiding this comment

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

In general looks good to me. Please fix the failing tests and see some minor comments.

@KapJI do you want to take a look as well? :)

glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/scanner.py Outdated Show resolved Hide resolved
glocaltokens/scanner.py Show resolved Hide resolved
Comment on lines +160 to +162
_LOGGER.debug(
'Won\'t add device since model "{}" is not in models_list'.format(model)
)
Copy link
Owner

Choose a reason for hiding this comment

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

Since we fallback to fetching all devices if no model_list is provided we can just keep it i guess :)

tests/test_utils.py Outdated Show resolved Hide resolved
tests/test_utils.py Outdated Show resolved Hide resolved
@KapJI
Copy link
Collaborator

KapJI commented Mar 22, 2021

Looks good to me overall

Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
Signed-off-by: Arnau Mora <arnyminer.z@gmail.com>
@ArnyminerZ ArnyminerZ requested a review from leikoilja March 23, 2021 17:12
Copy link
Owner

@leikoilja leikoilja left a comment

Choose a reason for hiding this comment

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

Looks great to me!
@ArnyminerZ can you please fix failing tests that are broken now after you have added censor method? :)

Also, do you mind us finding a way to pass the verbose parameter her to the GLocalAuthenticationTokens that will set the logger level to debug? I can do that tomorrow if you'd like :)

@leikoilja
Copy link
Owner

@ArnyminerZ, @KapJI just pushed test fixes and verbose logging argument. Please take a look if you guys agree with it :)

glocaltokens/client.py Outdated Show resolved Hide resolved
glocaltokens/utils/logs.py Outdated Show resolved Hide resolved
glocaltokens/utils/logs.py Show resolved Hide resolved
glocaltokens/utils/logs.py Outdated Show resolved Hide resolved
glocaltokens/utils/logs.py Outdated Show resolved Hide resolved
@leikoilja leikoilja requested a review from KapJI March 24, 2021 19:35
Copy link
Collaborator

@KapJI KapJI left a comment

Choose a reason for hiding this comment

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

Thanks! 🚀

@leikoilja leikoilja merged commit 409dc16 into leikoilja:master Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request patch Patch changes. Used for release bump
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add more logging
4 participants