Skip to content

Add log level changed message when user changes Z-Wave JS log level#9238

Merged
bramkragten merged 6 commits intohome-assistant:devfrom
raman325:log_level
May 25, 2021
Merged

Add log level changed message when user changes Z-Wave JS log level#9238
bramkragten merged 6 commits intohome-assistant:devfrom
raman325:log_level

Conversation

@raman325
Copy link
Copy Markdown
Contributor

@raman325 raman325 commented May 23, 2021

Proposed change

This is similar to #9062 in that when the user changes the log level on the logging UI page, there's no feedback to confirm that the log level actually changed. When you go from a more noisy to a less noisy log level in particular, it almost seems like something was broken.

I fixed a a bug that this exposed where you can't go back to the original log level that was set when you first loaded this page without a hard refresh. This is because we never updated the stored logConfig so setting it back to the original would
return early.

CC @cgarwood

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (thank you!)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example configuration

Additional information

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

@raman325
Copy link
Copy Markdown
Contributor Author

raman325 commented May 23, 2021

Right now, I am updating the stored log level in the stored log config directly, but we could call _fetchData instead and retrieve the entire object from the server, with the idea being that theoretically the config could have been changed elsewhere. Only problem is that based on that logic, we will only know about the change when the user changes the dropdown.

I've proposed adding an upstream event that gets sent whenever the log config gets updated that we could subscribe to here to keep the state up to date even if the config was changed elsewhere. That would also fix this bug. zwave-js/zwave-js#2672

@cgarwood
Copy link
Copy Markdown
Member

I think this approach is fine. If a person is on the log view page, there's (in theory) little chance they'll change the log level somewhere else and not know or realize they changed it.

raman325 and others added 2 commits May 24, 2021 16:50
…ve_js-logs.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
@bramkragten bramkragten merged commit 1bb025c into home-assistant:dev May 25, 2021
@raman325 raman325 deleted the log_level branch May 25, 2021 16:02
@bramkragten bramkragten mentioned this pull request May 26, 2021
@github-actions github-actions bot locked and limited conversation to collaborators May 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants